AddFieldValue

Description

Adds the specified value to the list of values in the named field.

This method is similar to SetFieldValue, except that it adds an item to a list of values, instead of providing the sole value. This method is intended for fields that can accept a list of values. If a field does not already contain a value, you can still use this method to set the value of a field that takes a single value. No validation takes place during the call to AddFieldValue.

The AddFieldValue method is designed to work with list fields. It is not designed to work with scalar fields (such as string, multiline string, and reference).

No validation takes place during a call to the AddFieldValue method. To determine whether a field contains a valid value, obtain the FieldInfo Object for that field and call ValidityChangedThisSetValue of the FieldInfo object to validate the field.

You can call this method only if the Entity object is editable. To make an existing Entity object editable, call EditEntity of the Session object.

Syntax

VBScript


entity.AddFieldValue field_name, new_value 

Perl


$entity->AddFieldValue(field_name, new_value); 
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.
field_name
A String containing a valid field name of this Entity object.
new_value
For Visual Basic, a Variant containing the new value to add to the field. For Perl, a String containing the new value.
Return value
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


AddFieldValue "field1", "option 1" 
AddFieldValue "field1", "option 2" 
AddFieldValue "field1", "option 3" 

Perl

$entity->AddFieldValue("field1", "option 1");
$entity->AddFieldValue("field1", "option 2");
$entity->AddFieldValue("field1", "option 3");