When we create a CRM Quote, the Total Tax of the quote is calculated as the sum of individual taxes of the respective Quote Products. i.e., Tax can only be declared for Quote Products. There could be situations where default tax % has to be set instead of asking the end user to enter the tax manually. Since MS CRM doesn’t provide a direct way of doing this, either of the options explained below can be adapted.
- Use JavaScript to calculate the tax on ‘OnSave’ event of the Quote Product
(OR)
- Write a plug-in to calculate the tax (MS CRM 2011 online also supports custom plug-ins)
Though wither of the above work, they do fail when checked against ‘Existing Product->Default Price’ products i.e…, if the Quote Product is defined as an Existing Product using Default Price.
For such Products, Price (Detailed Amount) is populated by the CRM itself, but from where does MS CRM get this value?
Default Price is defined in the PRODUCT’s Price List Item:
Default Price is defined in the PRODUCT’s Price List Item:
Armed with the above we’re ready to find why the above two options failed?
- OnSave JavaScript is fired before the actual save of the CRM. But Price of the Quote Product is populated after the SAVE of the CRM form. So, for the first time a Quote Product is saved the TAX always remains ‘0.00’. Fix for this is to resave the record manually so that the “tax” is calculated properly. However, second resave will have flickering effect as the MS CRM form is saved twice, which may not be liked by the end users.
- Plug-in also failed to get the ‘Price’ of Quote product even when using: Post Image.
So, workaround is to calculate the TAX using Plug-in but instead of calculating tax on the ‘price’ of Quote Product,
- Get the PRICE of Quote Product manually
As shown in the above image a query expression is used to get the ‘Price List Item’ where, Price list = Price List of respective Quote
Product = Product of respective Quote Product
And
Unit = Unit of respective Quote Product - Once the respective “Price List Item Id” is fetched, calculate tax on this Price and save the Quote Product.
This Plug-in should be deployed on both ‘Update’ and ‘Create’ message of the Quote Product entity. Once a quote product is created or updated, the plug-in triggers, calculates the ‘Tax’ and updates the field accordingly.
For microsoft dynamics crm services at best affordable price and best quality services visit : http://osmosys.asia/crm-services
For microsoft dynamics crm services at best affordable price and best quality services visit : http://osmosys.asia/crm-services
No comments:
Post a Comment