- Mark as New
- Bookmark
- Subscribe
- Permalink
- Email to a Friend
- Report Inappropriate Content
Problem with IF merge field in invoice template - "Error! Unknown op code for conditional"
Question:
Hi,
I have a problem with an IF conditional statement in my invoice template. The IF statement is this:
{ IF { MERGEFIELD Invoice.AdditionalNotes__c \* MERGEFORMAT } <> "" { MERGEFIELD Invoice.AdditionalNotes__c \* MERGEFORMAT } { MERGEFIELD Account.AdditionalNotes__c \* MERGEFORMAT } \* MERGEFORMAT }
It works correctly except when in the Invoice.AdditionalNotes__c or Account.AdditionalNotes__c fields there is a value with double quotes character. In this case in the resulting PDF I see the following error:
Error! Unknown op code for conditional.
How can I fix this issue?
Solution:
Upon checking further on this, this is not an issue with Zuora merge field functionality but its an issue/limitation in Microsoft Word mail merge functionality itself.
When a IF condition is used and When a double quotes are used in any field values, the Word thinks it has a delimiter, rather than being part of the data. Hence it will throw an error "Error! Unknown op code for conditional" or do not display the doubles Quotes character. However, using Double Quotes values outside of IF condition works fine.
Examples are as below:
Sample Invoice template Setup:
Invoice Custom Field Setup:
PDF OUTPUT:
Once we remove the double quotation( " ), invoice PDF printed without any issues:
Bunch of articles covering this WORD issue:
https://answers.microsoft.com/en-us/msoffice/forum/all/if-statement-with-embedded-double-quotes/4b6b...
https://forum.aspose.com/t/double-quotes-in-mergefields/68261/4
http://www.wordbanter.com/showthread.php?t=123551
http://www.wordbanter.com/showthread.php?t=70520
http://www.gmayor.com/formatting_word_fields.htm
Workaround:
We can use two single quotes together in a field instead of direct double digit value.
If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √