CRM 2015 Product changes Tag

Finance

Custom Price Calculations in CRM 2015

In our last few discussions we have focused on the Product Catalog enhancements. And in this discussion we will look at the Custom Price Calculation feature, which is related to the Product Catalog enhancement.

 

As we know, the pricing engine in Microsoft Dynamics CRM supports a standard set of pricing and discounting methods. These standard fields and methods might be a limitation on your business depending on your specific requirements for applying taxation, discounts, and other pricing rules for your products.

 

Suppose we need to identify and apply additional Taxes, like GST, VAT, Stamp Duty, or state and federal taxes independently on each line items. This would have been very difficult to achieve in previous versions of Dynamics CRM, because only one Tax field on line items was available. If we created custom fields for additional taxes, then it was really hard to include those in the calculation of the Extended Amount on each line item.

 

But now it is easy in CRM 2015, we can apply the Custom Price Calculation on the following entities.

  1. Opportunity
  2. Opportunity Product
  3. Quote
  4. Quote Product
  5. Order
  6. Order Product
  7. Invoice
  8. Invoice Product

 

To use the custom pricing for your opportunities, quotes, orders, and invoices, you need to do the following things:

 

  1. Set the value of the OOBPriceCalculationEnabled attribute to false from System Settings, as shown below.

d-blog-5-1

  1. Create a plug-in that contains your custom pricing logic for calculating the price for your opportunity, quote, order, or invoice and on corresponding line items.
  2. Register the plug-in on the CalculatePrice message on Post stage.

 

When the OOBPriceCalculationEnabled attribute is set to 0, every time an opportunity, quote, order, or invoice is created or changes, the plug-in registered on the CalculatePrice executes to calculate prices as specified in your custom code in the plug-in. The CalculatePriceRequest message doesn’t have any usage scenario of its own. It’s exposed so that you can plug in your own custom pricing calculation logic if you don’t want to use the out-of-box pricing provided by CRM.

 

If you want to revert to using the out-of-box pricing for your opportunities, quotes, orders, and invoices, set the value of the OOBPriceCalculationEnabled attribute to True.

 

We had one scenario in which we need to apply the GST and VAT based on the Amount and calculate the Extended Amount on the Quote Product, as shown below.

d-blog-5-2
As you can see in the above screen shot, we are calculating GST and VAT based on the Amount, and all taxes have been included in calculating the Extended Amount.

 

For example, we used the following logic in our plug-in.

decimal total = 0;

decimal vat = 0;

decimal gst = 0;

decimal extended = 0;

 

total = total + ((decimal)e[“quantity”] * ((Money)quoteItem[“priceperunit”]).Value);

gst = total * (decimal)0.08;

vat = total * (decimal)0.1;

extended = total + gst + vat;

quoteItem[“baseamount”] = new Money(total);

quoteItem[“tax”] = new Money(gst);

quoteItem[“new_vat”] = new Money(vat);

quoteItem[“extendedamount”] = new Money(extended);

 

service.Update(quoteItem);

 

And we have registered that plug-in on Post stage of CalculatePrice Message of Quotedetail, as shown below.

d-blog-5-3

If you want to implement the Custom Pricing calculation, then you can use the sample plug-in which is provided by Microsoft, and that will really help you and save your lot of time. Below I have given the URL of that plug-in example.

 

https://msdn.microsoft.com/en-us/library/dn817877.aspx

 

Again below we have given some important facts about the custom pricing calculations.

 

  1. You must set the OOBPriceCalculationEnabled value to False to enable the custom pricing calculation.
  2. You must register the plug-in on the Post Stage of the CalculatePrice message.
  3. Once you have enabled the custom pricing calculation, then the Amount and Extended Amount on line items and all totals on headers will no longer be system calculated. And you have to register your plug-in for these calculations.
  4. Also one most important thing is that, it seems that when you enable the Custom Pricing, then the calculation happens in asynchronous mode, hence you need to refresh the form to view the changes, if you change Price or Quantity within line items.

Product Localization

Product Localization in CRM 2015

“Small things can make a big difference” Yes this is what Microsoft has done in their latest release of CRM 2015 for Products.

 

In our earlier blog Product Catalog enhancement in CRM 2015, I briefly explained about all areas of Product Catalog that are modified in CRM 2015.

 

In this blog we have explained how the product localization works and how we can setup that in CRM 2015.

 

If we take an example of a multinational clothing company, and suppose that company sells “Trousers” in USA, Spain and China, then in earlier versions of CRM we needed to create 3 products with following names.

  • Trousers for US English
  • Pantalones for Spanish
  • 褲子 for Chinese

 

But now in CRM 2015, you just need to create only one Product record and you can localize the name of that product for all of the installed languages.

 

Along with Product name you can localize the following properties of the Products.

  • Product.Name
  • DynamicProperty.Name
  • DynamicPropertyOptionSetItem.DynamicPropertyOptionName
  • DynamicPropertyOptionSetItem.DynamicPropertyOptionDescription

 

I have created one Product Family in CRM named Trousers, and added 2 properties one is Size and another is Type, as shown below.

Product Family

 

Type is an Option Set property, and we have added 2 types into that.

trousers

 

Now I would like to set the Name in the Spanish language as well. Hence I have changed my language to Spanish and again opened the same product record. But this time it shows Name of product and properties in Read-only format. As shown below.

Familia De-Productos

 

So the question is, how can we change the name in different languages?

 

Don’t worry, you just need to follow the below steps for localization of the Product.

  • Open CRM, and go to Settings à Data Management.
  • Now click on the Export Field Translation link, as shown below.

Data Management

 

It will export “CrmFieldTranslations.zip” file.

  • Extract that zip file then you will see the following 2 XML files.
  1. [Content_Types].xml
  2. CrmFieldTranslations.xml

 

As shown below.

translation

 

  • Now you need to edit the “CrmFieldTranslations.xml” file in excel, then you will see Localize Labels sheet. As shown below.

CRM Field Translation

 

In that sheet, you can see the columns for the various installed languages in the System. Those column names indicate the language codes of the installed languages in the CRM.

  1. 1003: for US English
  2. 1036: for French
  3. 2052: for Chinese
  4. 3082: for Spanish.

 

And apart from language columns this sheet contains the following additional columns as well.

  1. Entity Name: It displays the name of Entity like Product, or DynamicProperty etc…
  2. Object Id: It displays the Guid of corresponding Product or DynamicProperty record.
  3. Object Column Name: It display the field name of the corresponding entity.

 

  • Now you need to set the corresponding values for the various languages, as shown below, I have set the values for French, Chinese and Spanish languages.

CRM Field Translation

 

  • Now you need to save the “CrmFieldTranslations.xml” file and again zip the “[Content_Types].xml” and “CrmFieldTranslations.xml” files. As shown below.

Content Type

  • Click on “Import Field Translations”.

Data Management

  • Then select our zip file and click on the OK button.

Data Management

After completing the import, if you change your language, then you can see the Name and other Description in other languages as well. As shown in below screens.

 

In Spanish

resumen

 

resumen

 

In Chinese

chinese

 

chinese

 

Below I have given some important facts about Product Localizations.

  1. Records with localized attributes are read-only unless your preferred language is the organization’s base language. You can’t manually change the products values of localized attributes into different languages.
  2. If your language in CRM is not the Organisation’s base language, then you can’t create the Product record.
  3. When you query on product using values for localized attributes, the conditions will be evaluated using your preferred language first and will revert to the base language if there is no localized value for that attribute.

 

Suppose your CRM base language is English, and another language Spanish, is installed into CRM.
And there is product defined in CRM and the name of that product is as follows.

In English: Trousers
In Spanish: Pantalones

 

Now suppose, your preferred language is Spanish and if you search product with name “Trousers”, then first it will search in your referred language i.e. Spanish, but it will not find any result. After that, it will search in using the Base language and display the result. As shown below.

D-blog-4-15

 

Hope this will help you!