Dynamic Content Using Formulas
iDialogue supports the embedding of dynamic content using Salesforce formula fields.
Example: “If Shipping Country equals US, then append a contract clause about US Shipping”.
To inject a US shipping clause into a document, select the master record type. In this case the “Opportunity” record.
Custom Formula Field
Create a custom formula field of type Text.
Macro
Create a macro IF( ShippingCountry = ‘US’, ‘Text to display’, ‘Else alternative text’ )
Note: The maximum number of displayed characters after an evaluation of a formula expression is 1,300.
Name the Custom Field
Name the custom field: “Contract_US_Shipping_Clause__c”
Insert a tag into the Word document where the clause should appear. {{Opportunity.Contract_US_Shipping_Clause__c}}
Upload, validate, and generate a PDF from a test record to validate text formula.
Dynamic Contract Clauses
When text formula fields return a value that starts with clause__
(double-underscore), it’s assumed the dynamic content is defined in the Contract Clause library, and what follows clause__
is the Developer Name of a Clause custom metadata type.
The contract clause library is accessed from settings. Search for Custom Metadata and select “Manage Records” for the “Contract Clause” metadata type.
Create a new clause by defining the following fields:
- Clause name
- Clause Developer Name (referenced in formula fields with
clause__Developer_Name
prefix) - Active enabled
- The clause text to be inserted into document template (replaces a formula field tag mapping)
Clause Formula Field
Create a Text formula field on the document template master record with conditional logic that returns one, many, or blank strings.
If the returned value starts with clause__
then the clause library content Text is used in the document template. Use the Developer Name when returnin clause values. Example clause__Guarantee__Clause
.
Map the custom formula field to any document template, as you would with any other tag builder field. Many formula fields may be defined for many conditional clauses.