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.