Friday, 11 August 2017

Set property of type Money in Microsoft CRM 2011


How to correctly change and set property of type Money in Microsoft CRM 2011


Yesterday I found out that setting property of type Money on entity can make really difference.
I’m altering Account records via WCF service one at a time and saving the changes in CRM 2011. I was changing some money property like this :
entity.SomeMoneyProperty = new Money() { Value = decimalValue };
Everything compiled and worked fine until I realized, that the value I was setting really isn’t stored in the CRM. But there was no runtime error, nothing.
So I searched the CRM 2011 SDK and found out, that they use only this type of creating the Money property :
entity.SomeMoneyProperty = new Money(decimalValue);

No comments:

Post a Comment

How to Call an Action through Power Automate(MS Flow)

  Introduction As Microsoft is providing us more flexibility with Power Automate (MS Flow), recently we found that now we can call the Actio...