Properties available on all types of fields in MS CRM

The following table shows the properties that are available on all fields.

General field properties Type Values
{Field}.DataValue Varies for each field type Get/set property.Valid for all field types. Note that setting the field value in a script does not raise the OnChange event. You can use the FireOnChange field method to perform this function.
{Field}.Disabled Boolean Get/set property.The field is displayed as read-only to the user. However it can be updated by a script. This field is submitted to the server when it is modified.

Example

var oField = crmForm.all.SOME_FIELD_ID;

// Toggle the disbled state of the field

oField.Disabled = !oField.Disabled;

{Field}.RequiredLevel   Get property.Determines the level of requirement for the field. Valid values are as follows:

0 = No constraint (normal)

1 = Business recommended

2 = Business required

Example

var CRM_REQUIRED_LEVEL_NORMAL = 0;

var CRM_REQUIRED_LEVEL_RECOMMENDED = 1;

var CRM_REQUIRED_LEVEL_REQUIRED = 2;

var oField = crmForm.all.SOME_FIELD_ID;

switch (oField.RequiredLevel)

{

   case CRM_REQUIRED_LEVEL_NORMAL:

      alert(“This field is not required or recommended”);

      break;

   case CRM_REQUIRED_LEVEL_RECOMMENDED:

      alert(“This field is business recommended”);

      break;

   case CRM_REQUIRED_LEVEL_REQUIRED:

      alert(“This field is required”);

      break;

}

{Field}.IsDirty Boolean Get property.True if the field’s value has changed.

Example

var oField = crmForm.all.SOME_FIELD_ID;

if (oField.IsDirty)

{

   alert(“The field’s value has changed.”);

}

else

{

   alert(“The field’s value has not changed.”);

}

{Field}.ForceSubmit Boolean Get/set property.Determines whether the value will be submitted to the server on save. All enabled fields will be submitted after they have been modified either through script or by user input.

Set this property to True for disabled or read-only fields and for fields that have not been modified if you want to submit them.

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


%d bloggers like this: