Calculate Total Tax On Opportunities, Quotes & Orders From Related Line Items


Some may argue (and they have! 🙂 ) that tax should never be calculated in Dynamics 365, and should only be used in a finance package. I would tend to agree from the point of view of an order/invoice, but a sales organisation using D365 is probably using the Opportunity & Quotes entity and needs to create a quote document to send to prospects and clients. So, therefore, there are situations when the tax needs to be displayed and calculated within D365. In the UK tax (or VAT) is calculated at 20%. So how do we get this on the Quote record (we will use this as the example)?

Each time a new quote line item is added, the Total Tax line on the main quote is a sum of the tax field on all of related line items. Trying to create a business rule or workflow on the quote entity to calculate the 20% is futile, as the record will continue to calculate that field using standard out of the box code, and go back to the sum of tax on the mentioned line items. You can see the tax field below on a line item is just empty. You could manually type something in, but who has time for that?

So, let’s set up a business rule to help us out. This will be created on the quote product entity. The scope should be set as Entity. If you set it to run on a form it will only run when the form is open, which again is a huge time waster for the end user. Running it on the Entity will make sure it runs each time a new quote line is added to the main quote record.

Next, we will set the Condition to make sure the Price Per Unit field contains data, then add a set value step to calculate the tax.

The value will be a formula run on the Tax field. This will be the Amount field multiplied by 0.20. This will give us 20% of the amount on the quote line.

Now go ahead and add a new quote line to your quote. You should see the tax value automatically calculated.

This will then update the Total Tax field on the main quote.

Finally, lock down the tax field on the quote product record by making it read only. This will make sure it can only ever be calculated using the business rule. Keep in mind if you start from an Opportunity you will need to set up the same business rule for calculating tax there, or if you go straight to an Order you might need to add the business rule there. Now you can display the tax on any word documents you might create for quotes.


Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Articles