The test attribute of tc:conditional is used to test whether a condition is true. You can test any system fields (object attributes) belonging to an object, EXCEPT for check-boxes. A condition is true when a value exists for that attribute. For example, you can test whether a custom object record such as Claim has a parent selected in the Parent system field.
You can also test the list of sub-objects added to a record to check whether any instances of that sub-object exist. If at least one instance of the sub-object is found, then the condition is true, and the content nested within the tc:conditional tag is generated. For example, if there is at least one Address added to a Contact, then the condition is true.
Unlike the compare tag attribute, the test attribute does not check the type of the sub-object. Any instance found proves the condition to be true.
Example: |
<tc:conditional test="MainAssignee"> Please contact the following associate with any questions you might have about your claim. <tc:data select="User"> <tc:data select="Contact"> <tc:data select="FirstName" /> <tc:data select="Name" /> </tc:data></tc:data> </tc:conditional> |
In this example, the text and tags that are nested within tc:conditional will only be inserted into the generated document if a Main Assignee exists for the Claim record.