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);

And with this aproach, everything worked fine 🙂 THX SDK, I

Leave a Reply

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