Doc Gen - Conditional Logic on Word Template in salesforce - Conditional Test to display content from a field.

  • 6 April 2023
  • 2 replies

Userlevel 4
Badge +6

Struggling to find examples of how use data from salesforce as the "conditional Content here" which is taken from the XML examples

Only display content if a check box field is marked True:

<# <Conditional Test="//Opportunity/HasOverdueTask[text() = 'True']" /> #>CONDITIONAL CONTENT HERE<# <EndConditional /> #>

I can get the conditional test to work and display eg, output would display CONDITIONAL CONTENT HERE if using the above code.

I would like the conditional content to be data from a field within salesforce.

i have tried the following but all output the same error: TemplateErrorExists:Conditional and matching EndConditional tags must be in the same paragraph as conditional content OR in their own paragraphs above and below conditional content.

<# <Conditional Test="//Opportunity/Alternative_EULA__c [text() = 'True']" />

#>/Opportunity/Account.Alternative_EULA__c <# <EndConditional /> #>

<# <Conditional Test="//Opportunity/Alternative_EULA__c [text() = 'True']" />

#>"/Opportunity/Account.Alternative_EULA__c"<# <EndConditional /> #>


<# <Conditional Test="//Opportunity/Alternative_EULA__c [text() = 'True']" />

#><Content Select="/Opportunity/Account.Alternative_EULA__c"/> <# <EndConditional /> #>


<# <Conditional Test="//Opportunity/Alternative_EULA__c [text() = 'True']" />

#><# <Content Select="/Opportunity/Account.Alternative_EULA__c"/> #> <# <EndConditional /> #>

Any help or direction to resources that give example of similar logic in action would be welcomed. I am trying to maintain a single template, rather than having the conditional logic to choose between 2 templates.


Best answer by Community Expert 6 April 2023, 14:46

View Original

2 replies

Userlevel 1
Badge +12

I solved this using by putting the code into separate rows.

<# <Conditional Test="//Opportunity/Alternative_EULA__c [text() = 'True']" /> #>


<# <Content Select="/Opportunity/Account.Alternative_EULA__c"/> #>


<# <EndConditional /> #>

So, the specific request solved BUT would still welcome links to resources that goes into depth on how to use logic on templates?

Userlevel 2


Thank you for reaching out here in the DocuSign Community.

Glad to hear you were able to solve your initial issue, the following article has more information on conditional logic within DocuSign Gen using a Word-based document:

Let us know if you need further assistance with this.

Best regards,

Nathaly | DocuSign Community Moderator

"Select as Best" below if you find the answer a valid solution to your issue!