SetFieldChoiceList
Description
Sets a list of acceptable values
for the field. Resets a dynamic choice list. Can be used with InvalidateFieldChoiceList to
empty any values already stored.
Use this function to force the DevOps Plan application to fetch the new choice list values for the field.
You can design your schema so that DevOps Plan recalculates
a choice list every time a user interacts with it (no cached values),
or only the first time (cached values). If you want to refresh cached
values, call InvalidateFieldChoiceList to
empty any cached values, then call SetFieldChoiceList to reinitialize
the values. (The first time the choice list appears, there is no need
to call InvalidateFieldChoiceList because
no values pre-exist in cache memory.)
Use these two methods in a Value Changed Field hook. For example, if the end-user selects a new item from the list of projects, the record type changes, and the form needs a refreshed dependent choice list.
Syntax
Perl
$entity->SetFieldChoiceList(fieldName, choiceList);
- Identifier
- Description
- entity
- An Entity object representing a user data record. Inside a hook, if you omit this part of the syntax, the Entity object corresponding to the current data record is assumed.
- fieldName
- A String that identifies a valid field name of an entity.
- choiceList
- A reference to an array of strings.
- Return value
- None.
Example
Perl
$entity->SetFieldChoiceList($fieldname, \@choiceList);
# Add choices by adding strings to the array of field choices