Set Field Required Dynamically – Using JScript for CRM 4.0

Posted: September 1, 2010 in JScript, Microsoft Dynamics CRM
Tags: , ,

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;

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

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