Providing an Expression to Make a Custom Field Conditionally Updateable

A custom field can be updateable or read-only. By default, any non-formula field is updateable. Alternatively, you can configure a conditionally updateable expression.

If you do this, it is evaluated each time a page displaying the field is rendered or refreshed. The expected return type the expression is boolean. If you define one for a field, you must also configure the Depends On list to indicate the names of any fields on which your conditionally updateable expression depends. By doing this, your conditionally updateable field will interactively enable or disable as appropriate when the user changes the values of fields on which the conditionally updateable expression depends.

For example, consider a custom TroubleTicket object with Status and Justification fields. Assume you want to prevent a user from editing the justification of a closed trouble ticket. To achieve this, configure the conditionally updateable expression for the Justification field as follows:

Status_c != 'Closed'

After configuring this expression, you must then indicate that the Justification field depends on the Status field as described in Understanding Automatic Dependency Information for Cascading Fixed-Choice Lists.. This ensures that if a trouble ticket is closed during the current transaction, or if a closed trouble ticket is reopened, that the Justification field becomes enable or disabled as appropriate.

Tip: A field configured with a conditionally updateable expression only enforces the conditional updateability through the web user interface in this release. See Enforcing Conditional Updateability of Custom Fields for Web Service Access for more information on how to ensure it gets enforced for web service access as well.

Caution: It is not recommended to assign a new value to any field as part of the code of a conditionally updateable expression. The script can consult the value of one or more fields, but should not assign a new value to any field in the row. Doing so will cause unexpected behavior in the user interface, may impact runtime performance, and can cause deadlocks.