Update Option List Fields
When you call the updateOptionListField method to update an Option List field, you must use the same required parameters as for updateField. Additionally, you can add, update, or delete options. You specify the related options to be updated in the collection of options in the Option object. Behavior for each option is as follows:
Add: If no related field option matches the specified identifier, the option is created.
Update: If a related field option matches the specified identifier, the option is updated.
Delete: If a related field option is not specified in the collection, the option is deleted.
updateOptionListField() Method Definition
public static IMaxObject updateOptionListField(String relatedObjectFullIdentifier, String fieldFullIdentifier, Collection<Option> options, Map<String,Object> values)
Example
To update test_option_list_field in the Showcase object to add Option 4 and delete Option 3:
import com.servicemax.core.utils.Definitions
import com.servicemax.core.definitions.Option

def options = []
options << new Option('Option 1', 'option1', 1)
options << new Option('Option 2', 'option2', 2)
options << new Option('Option 4', 'option4', 4)
Definitions.updateOptionListField('io_showcase', 'io_test_option_list_field', options, [:])
For more information:
Was this helpful?