Showing posts with label CRM 2011. Show all posts
Showing posts with label CRM 2011. Show all posts

Wednesday, May 23, 2012

Changing CRM form properties in Javascript doesn't trigger onChange

I've just learnt the hard way that when you change a field value on a MS CRM 2011 form via JavaScript it doesn't automatically trigger any onChange event which is wired up to that field.
To manually trigger any onChange event you do the following


Xrm.Page.getAttribute('myfieldname').fireOnChange();


or better yet, if you use a custom library to simplify your read


SetAttributeValue = function (attributeString, value) {
 var attribute = Xrm.Page.getAttribute(attributeString);
 
 if (attribute) {
  attribute.setValue(value);
  // manually fire the onChange event.
  attribute.fireOnChange();
 }
};




Friday, September 9, 2011

Creating Entities with dates in MS CRM 2011

MS CRM stores date values internally in UTC date format, so when I was programmatically creating appointments earlier this week I was getting weird date issues.

The solution is really simple