Create Option List Fields
When you call the
createOptionListField method to create an
Option List field, you must specify the following required parameters, in addition to the required parameters for the
createField method. For more information, see
Create Fields.
Parameter
|
Description
|
name
|
Name of the created option.
|
identifier
|
Identifier of the created option.
|
ordering position
|
Ordering position of the created option.
|
The following fields are automatically set and cannot be overridden:
• io_uuid: Automatically generated.
• io_deleted: Automatically set to false.
• io_namespace: Automatically set to the namespace to which the field belongs.
• io_application: Automatically set to the application to which the field belongs.
• Signature fields (created_on, created_by, and so on).
• io_owner: Automatically set to the authenticated user.
All other optional relationship fields are set to default values.
createOptionListField() Method Definition
You specify options by using the collection of the com.servicemax.core.definitions.Option object. The method creates a field and the options specified in the collection. If invalid parameters or options are specified, or the field or options could not be created on the platform (for example, because they are not valid), an exception is thrown.
public static IMaxObject createOptionListField(String relatedObjectFullIdentifier, String name, String identifier, String namespaceIdentifier, String applicationName, Collection<Option> options, Map<String,Object> additionalFields = [:])
Example
The following example shows how to create an Option List field named Test Option List Field with the test_option_list__field identifier for the Showcase object, in the io namespace and Max application. The related options are Option 1, Option 2, and 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 3', 'option3', 3)
Definitions.createOptionListField('io_showcase', 'Test Option List Field', 'test_option_list_field', 'io', 'Max', options)
|
Field creation with the Status data type is not supported at this time.
|
For more information: