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

PCF Framework - Quick Guide

  Let us see it in action using a sample project. Launching the test harness, we can see the  init  executed followed by  updateView . Makin...