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 HCL Compass client to fetch the new choice list values for the field.
You can design your schema so that HCL Compass 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
VBScript
entity.SetFieldChoiceList
fieldName, (choiceList)
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 (VBScript only).
- fieldName
- A String that identifies a valid field name of an entity.
- choiceList
- For VB, a Variant containing an array of strings.For Perl, a reference to an array of strings.
- Return value
- None.
Examples
VBScript
fieldchoicelist3 = array("hello", "world", "goodbye")
SetFieldChoiceList "severity", (fieldchoicelist3)
Perl
$entity->SetFieldChoiceList($fieldname, \@choiceList);
# Add choices by adding strings to the array of field choices