Overcome MultiCurrencyPlugin Issue D365

Problem
The currency of the record does not match the currency of the price list.

Details
We have some custom workflow process which generates sales order which create sales order from customer asset. We suddenly started getting issue in sales order creation. When I started troubleshooting I found this error is generated by MultiCurrencyPlugin
currencyerror

While troubleshooting I checked all the released records currency was matching with the pricelist used to create sales order and it was working fine and no changes is done in the system. While doing further troubleshooting I found somehow it was using currency of the user to create order and currency of the user was different then the currency in the pricelist.

So to resolve this issue while setting pricelist, I setup currency in the sales order like below and it started working


 salesorder["pricelevelid"] = billingaccount.GetAttributeValue<EntityReference>("defaultpricelevelid").Id);
 salesorder["transactioncurrencyid"] = billingaccount.GetAttributeValue<EntityReference>("transactioncurrencyid");

So while creating sales entities records make sure you are setting currency otherwise you may face this issue.

Summary
This is how we can fix MultiCurrencyPlugin issue.

Hope it will help someone !!
Keep learning and Keep Sharing !!

Leave a Reply

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