rbv_api.setFieldValue()
Purpose
This Object Script method sets the value of a field for an existing object record. For picklists and status fields, use integration names, since they will be valid after publishing and installing your application, unlike numeric ids.
When called outside of a transaction scope, for instance, in a JavaScript report, the
setFieldValue()
method changes the field value temporarily. The
setFieldValue()
method does not invoke triggers before or after the
update occurs. The reason is that this method can often be used repeatedly to update several
fields and invoking triggers on each update may result in undesired behavior.
Formulas used in Object Script triggers can include other API methods and regular Platform template functionality, such as loops. Object Script methods have no effect if called outside of update triggers.
Syntax
rbv_api.setFieldValue(objName,
Id, fieldname,
newValue)
Parameters
objName
Integration name of object
Id
ID of record
fieldName
Integration name of field to set value in
newValue
Value to be set
Return value
None
Permissions required
View permission for the selected object type.
Example
The following code sets a picklist (single-selection) or radio-buttons value:
rbv_api.setFieldValue("order", {!id}, "size", "S");
The following sets a picklist (multi-selection) or group of checkboxes value:
rbv_api.setFieldValue("order", {!id}, "size", Array("S", "M"));
An alternative use is with a comma-separated string of integration codes or numeric ids:
rbv_api.setFieldValue("order", {!id}, "size", "S,M"));