Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

Form Properties

CRM 1.2
banner art

Form properties are accessed with the following syntax:

crmForm.propertyname

The following table shows the available form properties.

Property name Type Values
IsDirty Boolean True if any fields in the form have been modified.
FormType Integer A read-only property that returns information about the form type. See Remarks.

Valid values:

Undefined Form Type = 0

Create Form = 1

Update Form = 2

Read Only Form = 3

Disabled Form = 4

Quick Create Form = 5

Bulk Edit Form = 6

ObjectId * String A read-only property that contains the ID of the entity instance displayed in the form. If the form is a create form, the value is null.
ObjectTypeCode * String A read-only property that contains the entity type code of the entity instance displayed in the form. See Entity Type Codes.
ObjectTypeName * String A read-only property that contains the entity name of the entity instance displayed in the form. For system entity names, see the EntityName enumeration..
all.{field name}   Used to reference a particular field or IFrame on the form.

Remarks

Important: You should always consider the form type in your code. In particular, consider how your code will work in the Quick create and Bulk edit forms.

The Quick create form only includes business required or business recommended fields.

Contact quick create form

If your code references a field that is not on the Quick create form, an error will occur. If your business logic requires certain fields to be present, you should set the Business Recommended constraint so that they will appear in the quick create form.

The Bulk edit form will not include existing data for each record that will be updated. If your business logic depends on specific data for each record to be present in the form, you may want to set specific conditions on which fields you will allow to be updated using the Bulk edit form

The following table contains additional information about form types.

Form Form type value Description
Undefined 0 For internal use only.
Create 1 This is the main form for an entity, displayed with blank values when creating an entity instance.
Update 2 This is the main form for an entity, displayed with the current values for the entity instance being updated.
Read only 3 This is the main form for an entity, displayed with the current values for the entity instance. All fields are disabled. This is used when the user does not have privileges or acess rights to edit the entity instance.
Disabled 4 This is the main form for an entity, displayed with the current values for the entity instance. All fields are disabled. This is used when the entity instance is in the Inactive state.
Quick create 5 This form is accessible from the lookup dialog. It is not available for custom entities. It contains the minimum fields needed to create an entity instance.
Bulk edit 6 This form is used for editing multiple instances at a time.

Example

The following code shows how to access the form properties such as form type.

var CRM_FORM_TYPE_CREATE = 1;
var CRM_FORM_TYPE_UPDATE = 2;
var CRM_ENTITY_ACCOUNT = 1;
var CRM_ENTITY_CONTACT = 2;

// Test the FormType and ObjectId properties.
switch (crmForm.FormType)
{
   case CRM_FORM_TYPE_CREATE:
      alert("This is a create form.");
      break;

   case CRM_FORM_TYPE_UPDATE:
      alert("This is an update form, the ID is " + crmForm.ObjectId + ".");
      break;
}


// Test the ObjectTypeCode property.
switch (crmForm.ObjectTypeCode)
{
   case CRM_ENTITY_ACCOUNT:
      alert("This is an Account form.");
      break;

   case CRM_ENTITY_CONTACT:
      alert("This is a Contact form.");
      break;
}

© 2007 Microsoft Corporation. All rights reserved.


Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.