Skip to main content

Posts

Showing posts from January, 2009

Restrict CRM 4.0 Form Fields via JavaScript

Recently had an issue where a series of calculated custom fields were inserted by a VAR, which would calculate the opportunity forecast value and another value for a forecast probability value. Code was placed on the OnLoad(), to perform this action, but changes to this form would not save. So users could edit further percentages, but reports and views would not reflect the new value. What I discovered, is that these fields were locked from saving data, as they were marked as read only. This was strange behavior, as new opportunities did not suffer from this, and the code that resided in the OnLoad() event was not coded to take account for only updates or create. I came across this post: , dealing with CRM 3.0. As a result, I customized the fields that were read only to normal. I then added this code to my OnLoad() event, to the Opportunity form, to disable the fields. var CRM_FORM_TYPE_CREATE = 1; var CRM_FORM_TYPE_UPDATE = 2; //Adjust the display of the calculated fields to inline //