7
AugWe will have to make several different pieces come together in order to create conditional line items tables. It involves grouping and conditional print fields. This way, the document becomes entirely dynamic. Keeping several different quote templates for various purposes can be risky because users have to choose the correct template. Having one quote template ensures that no wrong choices are made. No need to worry about it. That’s why keeping the process lucrative and straightforward with just one quote template makes total sense.
Different customers may ask for different outcomes in different situations. Sometimes it’s necessary to show line items grouped by different criteria, and sometimes a single table is needed. Let’s see how we can set this up following a specific example. Suppose the sales reps should have the possibility to show all line items ungrouped in a single table or grouped into separate tables based on Product Family.
Step 1. Create a custom checkbox on the Quote object which will determine whether separate tables are created.
First, go to Object Manager in Setup and click on the Quote object. In the Fields & Relationships, click New to create a Checkbox with the field label Assemble by Product Family. Set the necessary field-level security settings, then click Save.
Step 2. Create a custom formula field on the Quote object that simply will be doing the opposite of what the checkbox in the first step is doing, that is ungroup line items.
Staying on the Quote object, create a New Formula field in the Fields & Relationships with the field label Ungroup Line Items and the Formula Return Type Checkbox, and enter the following formula: NOT(Assemble_by_Product_Family__c)
Note: This field can be hidden from the Page Layout in order to keep the templates as clean as possible and not to confuse the users as they will be only using the Assemble by Product Family checkbox: when it is unchecked, the Ungroup Line Items field gets checked, and vice versa.
Step 3. Update the Conditional Print Field on the Template Section object with the API names of the two newly created fields in the previous steps. Make sure you copy those API names because you don't want to make a typo.
Go to the Fields & Relationships section of the Template Section object and click the Conditional Print Field. Scroll down to the Values list and click New to enter the necessary API names (Assemble_by_Product_Family__c and Ungroup_Line_Items__c in our case), then Save and exit Setup.
Step 4. Update the Line Items Section on the Quote Template to only be visible if the Ungroup Line Items checkbox is true.
Go the necessary Quote Template, and in the Related tab find the Section related list. Click Edit next to the Line Items. For the Conditional Print Field select the Ungroup_Line_Items__c value.
Step 5. Create a new Line Items Section which would only appear when Assemble by Product Family is checked.
To achieve this, click the Clone button and update the fields:
- For the Section Name field enter Assembled by Product Family
- We don't have to change the display order because we know that these will ever appear one at a time, but if you wish you could add 1 to the existing Display Order value.
- For the Conditional Print Field select Assemble_by_Product_Family__c
- For the Group Field, select Product Family
Now you can verify whether the Quote Template generates the output document with a single table when the Assembly by Product Family is unchecked or whether it creates separate tables for every single Product Family when Assemble by Product Family is checked. Thus, on the necessary quote, check or uncheck the Assemble by Product Family field then click Preview Document, Preview to see this functionality in action. Easy like this!
Comments (0)