Suppose there is a scenario in which you are generating a Quote Template and you need the template sections to be displayed based on certain condition. You can do this by using ‘Conditional Print Field’ field in Template Section object. It is a picklist field that stores API names of Quote object fields.
Scenario: There are 10 products that you provide. A user selects 3 products as Quote Line Items. And when the user generates the quote template, you want to add content related to the products that user selected and not for all 10 products.
- Create a check box field for each product in Quote object.
- Create custom settings that map product name with related field name.
- Write trigger to check / uncheck check boxes conditionally.
- Add API names of fields created in Quote object for each product in Conditional Print Field field in Template Section object.
- Create Template Section records in Quote Template record related list for each product’s Template Content record. Also assign ‘Conditional Print Field’ field value to API name of product.
- Go ahead and click on ‘Preview Document’ button and make sure to select correct Quote Template.