Multi-Cloud Service Orchestration & Delivery Platform

Value added tax (VAT) on Dynamics CRM invoices

V

Dynamics CRM Invoicing  – A better way to handle VAT (value added tax)

Dynamics CRM is a Customer Relationship Management System., and handling billing related operations with CRM is really a complex and tricky job because its not an accounting/billing system !  though CRM system does offer a basic invoicing flow but sometimes complex system customization is required in CRM to cover the complete billing life cycle.

We have a requirement in one of our Dynamics CRM / “Dynamics 365 for Sales” setup to add a handling in invoice entity form that will calculate VAT amount based on provided percentage value by billing / sales department.

By default, there is no way to handle VAT amount for CRM invoice based on some defined percentage value. Our basic goal to achieve a functionality where sales person has the ability to enter a VAT % with in a field and based on that a VAT amount should be calculated (added into another custom/built-in field) automatically and after saving/recalculating the invoice form vat amount should be added to the Total amount of the invoice.

How to compute “Value added tax” on CRM invoices ?!

Target Entity = Invoice

Create and Add a custom field with the following details on invoice form, which will hold vat percentage value.

  • Data type “Decimal Number”
  • Min value = 0
  • Max value = 100

secondly, In order to store VAT amount we need to use another field and for that we have used an existing field. i.e. “freightamount” ( data type currency), as we never used / utilized freight amount field so this can be used to hold vat amount. we have changed its display name to VAT Amount on Invoice form.

Once the vat percentage % is mentioned in the newly generated custom field, VAT amount gets calculated automatically. (Please note that the JS will triggers as an onchange event of that percentage field,. so it triggers as soon as we press “tab” key or click elsewhere on invoice form.

 

Following is the JS (web resource) which needs to be added to invoice entity form and use the “calculate” function as an OnChange event for newly generated custom field. i.e. “ms_invoicevatpercent”

 

function calculate ()

{

var val1 = Xrm.Page.getAttribute(“ms_invoicevatpercent“).getValue();

var val2 = Xrm.Page.getAttribute(“totalamount“).getValue();

if(val1==null) return;

if(val2==null) return;

var result = val1* val2/100;

Xrm.Page.getAttribute(“freightamount“).setValue(result);

}

 

Lets take a look the above handling in action !!

 

 

 Author : Jameel

For product & sales related queries, please email us at sales@machsol.com

Multi-Cloud Service Orchestration & Delivery Platform

Connect with MachSol

MachSol is Microsoft Certified Partner and Microsoft Validated Vendor having years of experience in cloud automation industry.

Categories