Export (0) Print
Expand All

All Field Types

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

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

General field propertiesTypeValues
{Field}.DataValueVaries for each field typeGet/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}.DisabledBoolean 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}.IsDirtyBooleanGet 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 BooleanGet/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.


The following methods are available on all fields:

General field methodsDescription
{Field}.SetFocus()Sets the focus, changes tabs, and scrolls the window as necessary to show the specified field.

Example

// Set focus to the field.
crmForm.all.SOME_FIELD_ID.SetFocus();
{Field}.FireOnChange()Programmatically raises the OnChange event for the specified field.

Example

// Set focus to the field.
crmForm.all.SOME_FIELD_ID.FireOnChange();

See Also

Concepts

Other Resources


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft