Returns an array of all active [[OptionItem]]s for this field.
Returns an array of all possible [[OptionItem]]s for this field, active, disabled, locked, and obsolete.
// get the stati of all the OptionItems
const statuses = field.allOptions().map(op => [op, op.status()]);
An object of alternate ids for this object, with values as [[AltId]]
An array of alternate ids for this object.
Same as calling optAncestor(var).orElse(null)
If this object is a Collection it returns it as an array. The majority of objects in the system are Collections. For most objects, this is the same as calling [[children]].
Get the children of the object. This retrieval goes one level deep.
OptionalclassType: string | numberThe "created at" timestamp of this object.
The creator of this object.
The deleted children of this object. Only looks one level deep. E.g. a form's deleted children could include fields and form entries. A folder's deleted children could include folders, forms, and formulas, but not any of those forms' entries.
Returns an array of all disabled [[OptionItem]]s for this field. A disabled [[OptionItem]] will show up on a form, but it won't be selectable.
The default display name of this object. For the most part, this is the same as calling toString(), which is the same as inserting the object into a string.
Sets the Display Name.
Returns this field's [[FormMetaData]] object.
Gets an array of all the object's ancestors.
The [[Id]] of this object bounded to T.
Returns whether the field is multi-select.
// get selected export values without knowing if it's single or multi
const selectedExport = field.isMultiSelect() ?
field.selectedExportValues() : field.optSelected().exportValue();
Returns the Local Cache object for this Thread/Base Object.
Same as calling optLock().orElse(null)
Returns an array of all locked [[OptionItem]]s for this field. A locked [[OptionItem]] will show up on a form, but it won't be selectable.
The lookup function finds a single option in the list of options using the custom lookup properties of the option items. Custom lookup properties come in two varieties: unique and non-unique. Names beginning with an underbar (_) do not have to be unique. Names that do not begin with an underbar must be unique name/value pair for any one type of Relate element within a single organization. Thus, if the name begins with an underbar there could be more than one option that has the same name/value pair associated with it. In this case, the first matching option will be returned.
// see whether the lowest or highest priority options were selected
// assumes you already have the functions handleLowest, handleHighest, and handleOther
const selExpVal = field.optSelected().map(op => op.exportValue());
const low = field.lookup('_priorityLevel', 'lowest');
const high = field.lookup('_priorityLevel', 'highest');
low.isSelected() && handleLowest(low);
high.isSelected() && handleHighest(high);
!low.isSelected() && !high.isSelected() && handleOther(selExpval);
Optionaloptions: stringReturns the [[FieldMetaData]] object that this describes this field.
The [[User]] that last modified this object.
Returns an array of all obsolete [[OptionItem]]s for this field. [[OptionItem]]s are marked obsolete if they are never going to be used again, but still need to exist for legacy data. Will not show up on a form.
Same as calling Optional.of(selected())
A [[Java.Optional]] of the ancestor with the specific class.
Returns an object where the members are the export value and the values are [[OptionItem]].
Returns an object where the members are the name and the values are [[OptionItem]].
A [[Java.Optional]] of the current object's parent object.
OptionalclassType: string | numberSame as calling optParent(var).orElse(null)
OptionalclassType: string | numberReset the current object so that it is cleared from the cache and looked up from the database.
Return an array of [[OptionItem]]s
Return an array of selected export values.
Return an array of selected names.
Returns a list of selected [[OptionItem]]s.
Sets or clears the OptionItem with the given ID. Returns true if successful.
The ID of the OptionItem to set
Optionalchecked: booleanDefaults to true
Sets or clears the OptionItem with the given export value. Returns true if successful.
The export value of the OptionItem to set
Optionalchecked: booleanDefaults to true
Sets or clears the OptionItem with the given name. Returns true if successful.
The name of the OptionItem to set
Optionalchecked: booleanDefaults to true
Sets or clears the OptionItems with the given ids. Returns a list of any that were not matched.
The list of IDs
Optionalchecked: booleanDefaults to true
Sets the selection of the current [[MultiSelectField]] field exactly like another [[MultiSelectField]], providing they use the same Option List.
// forward user preferences to a different account
let form = 'personalInfo', field = 'preferences';
B.queries.byFID['allPeople'].require().forms.byFID[form].require();
const getField = (id, form, field) => allPeople.byId(id).forms[form].fields[field];
getField(id1, form, field).setSelected(getField(id2, form, field));
The [[Id]] or [[AltId]] that the system deems most relevant.
Makes changes to the database for this object
Set the field's value.
Optional value for this field. Alias for [[opt]].
The versions of this object.
The versions of this object.
Returns a view URL for this object, if it has one. This value is always a relative URL, meaning it does not contain the protocol prefix or domain name such as http://xyz.bluestep.net.
A [[Field]] type that allows multiple values from a limited, pre-defined input. The possible input values are a list of [[OptionItem]]s (aka Option List).
Say you want the user to select several months. There are only 12 months in a year, and you know all of them already. Making this a [[MultiSelectField]] instead of a [[TextField]] will greatly improve the quality of the inputted data.