SetFieldValues
Description
Places the specified values in the named fields. This method allows multiple field values to be set with one call. The two input string arrays are parallel lists, where field_names lists the field names and new_values lists the field values. For example, item N in field_names provides the field name and item N in new_values provides the value for that field.
The return value is an array of result messages for each field.
Each result message is the same message that is returned by a single call
to the SetFieldValue
method.
If there are no errors, the result is a String array of the same number of
elements as field_names, with each element being an empty String.
Syntax
VBScript
entity.SetFieldValues
field_names, new_values
Perl
$entity->SetFieldValues
(field_names, new_values);
- 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).
- field_names
- The list of field names for values to be set.
For VBScript, a Variant containing an array of Strings. Each String contains a valid field name of this Entity object.
For Perl, a reference to an array of strings containing the valid field names.
- new_values
- The list of field values to set for the specified field
names.
For VBScript, a Variant containing an array of Strings. Each String contains a field value.
For Perl, a reference to an array of strings containing the new values.
- Return value
- For VBScript, a Variant containing an array of result messages
for each field.
For Perl, a reference to an array of strings containing the result messages for each field.
If changes to the field are permitted, this method returns an empty String; otherwise, this method returns a String containing an explanation of the error.
Examples
VBScript
Dim FieldList
ReDim FieldList(2) ' This sets up an array of three elements
Dim ValList
ReDim ValList(2)
FieldList(0)="new_field"
FieldList(1)="new_field2"
FieldList(2)="new_field3"
ValList(0)="f1"
ValList(1)="f2"
ValList(2)="f3"
entity.SetFieldValues FieldList, ValList
Perl
my @fieldnames = ("submitter", "owner");
my @fieldvalues = ("userA", "userB");
$entity->SetFieldValues(\@fieldnames, \@fieldvalues);