Happy Business Starts Here

Problem with IF merge field in invoice template - "Error! Unknown op code for conditional"

Rajkumar
Zuora Support

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:

 

Doubles Quotes Template.JPG

 

Invoice Custom Field Setup:

 

Doubles Quotes Invoice Detail.JPG

 

PDF OUTPUT:

Doubles Quotes Invoice.JPG

 

Once we remove the double quotation( " ), invoice PDF printed without any issues:

 

Doubles Quotes Invoice 2.JPG

 

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.

 

Doubles Quotes Invoice 3.JPG

 

Doubles Quotes Invoice 4.JPG

 






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √