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

Solution Architect with 15+ years of exp. Dynamics CRM, Power Platform, Azure which includes Solution, Design, Development, Deployment, Maintenance and support experience.

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: