Set Field Required Dynamically – Using JScript for CRM 4.0

switch (parseInt(event.srcElement.DataValue, 10))

{

/* Opportunity Rating Picklist */

case 1:

/* Hot */

crmForm.SetFieldReqLevel(“pricelevelid”, 1);

crmForm.SetFieldReqLevel(“estimatedvalue”, 1);

crmForm.SetFieldReqLevel(“estimatedclosedate”, 1);

crmForm.SetFieldReqLevel(“closeprobability”, 1);

break;

case 2:

/* Warm */

crmForm.SetFieldReqLevel(“pricelevelid”, 1);

crmForm.SetFieldReqLevel(“estimatedvalue”, 0);

crmForm.SetFieldReqLevel(“estimatedclosedate”, 1);

crmForm.SetFieldReqLevel(“closeprobability”, 0);

break;

case 3:

/* Cold */

crmForm.SetFieldReqLevel(“pricelevelid”, 0);

crmForm.SetFieldReqLevel(“estimatedvalue”, 0);

crmForm.SetFieldReqLevel(“estimatedclosedate”, 0);

crmForm.SetFieldReqLevel(“closeprobability”, 0);

break;

/* All other values */

default:

crmForm.SetFieldReqLevel(“name”, 0);

crmForm.SetFieldReqLevel(“customerid”, 0);

break;

}

Author: Arvind Singh

Microsoft Dynamics CRM Consultant

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s