16
FebIn a previous blog post, we discussed about adding quote subtotals to the quote:
List Total, Regular Total, Amount Total, and Net Total.
Regular Total and Discount Total are not always necessary because we're not always going to apply discount schedules or some additional discounts. It would make sense to make them appear when there is actually a discount applied, when there's a difference.
We can make them appear conditionally. To achieve this, we have to create some formula fields on the quote because that's where all of the conditional print fields are driven from.
First, go to Setup > Object Manager > Quote > Fields and Relationships and create a new field. This is going to be a formula field. Name it Display Regular Total with the return to checkbox.
The formula that we need here should say whether there is any difference between the list price and the regular price. Click Insert Field to find the necessary fields. So, if the Regular Amount does not equal to the List Amount, return true, else false. The formula should look like this:
IF ( SBQQ__RegularAmount__c <> SBQQ__ListAmount__c , TRUE, FALSE )
Check the syntax to make sure there are no errors.
Click Next, Next, Save and New.
Create the second formula field: Display Discount Total, again with the return to checkbox. This time, we'll check whether the Customer Amount is not equal to Regular Amount. If that's true, it means we have some kind of discount applied. So, the formula field will return true if that's the case and false otherwise.
IF ( SBQQ__CustomerAmount__c <> SBQQ__RegularAmount__c, TRUE, FALSE )
Again, don't forget to check the syntax for errors.
Now, go back to the corresponding sections and update the conditional print fields so that they are actually driven based on these two checkboxes.
Go to Setup > Object Manager > Template Section > Fields and Relationships. Find the Conditional Print Field and click New in Values. Paste here the two API names of the Display Regular Total and Display Discount Total fields. Click Save and close the tab.
Then, go back to the Sections, refresh and choose the right conditional print field. Thus, Regular Amount is going to be driven by Display Regular Total, and the Discount Amount section is going to be driven by Display Discount Total.
Now you can test this out by previewing the document to make sure everything is behaving as expected.
Comments (0)