How to create Group of OptionTypes

Hello Morpheus Community. I am working on Cloud Plugin. I want to create a group of OptionTypes in the Cloud Provider under Collection getOptionTypes(), because I have a bunch of OptionTypes. i want to create a group and put the similar optionsTypes in the group. I not able to create the group.
can anyone please help me.

@Override
Collection getOptionTypes() {
OptionType ot1 = new OptionType(
name: ‘Username’,
code: ‘do-username’,
fieldName: ‘doUsername’,
displayOrder: 0,
fieldLabel: ‘Username’,
required: true,
inputType: OptionType.InputType.TEXT,
fieldContext: ‘config’
)
OptionType ot2 = new OptionType(
name: ‘API Key’,
code: ‘do-api-key’,
fieldName: ‘doApiKey’,
displayOrder: 1,
fieldLabel: ‘API Key’,
required: true,
inputType: OptionType.InputType.PASSWORD,
fieldContext: ‘config’
)
OptionType ot3 = new OptionType(
name: ‘Datacenter’,
code: ‘do-datacenter’,
fieldGroup: ‘SomeFieldGroup’,
fieldName: ‘datacenter’,
optionSource: ‘datacenters’,
displayOrder: 2,
fieldLabel: ‘Datacenter’,
required: true,
inputType: OptionType.InputType.SELECT,
dependsOn: ‘do-api-key’,
fieldContext: ‘config’
)
return [ot1, ot2, ot3]
}

Hello,

Are you referring to using the “fieldGroup” property of the OptionType class? Please can you be more specific about what groups you want to use and what exactly is not working. Do you get an error?

Many thanks

@Override
Collection getOptionTypes() {
OptionType ot1 = new OptionType(
name: ‘IdentyAPIUrl’,
code: ‘identy-APIURL’,
fieldName: ‘identyapiurl’,
displayOrder: 0,
fieldLabel: ‘Identy API URL’,
required: true,
inputType: OptionType.InputType.TEXT,
fieldContext: ‘config’
)
OptionType ot2 = new OptionType(
name: ‘Domain Name’,
code: ‘domain-name’,
fieldName: ‘domainName’,
displayOrder: 1,
fieldLabel: ‘Domain Name’,
required: true,
inputType: OptionType.InputType.TEXT,
fieldContext: ‘config’
)
OptionType ot3 = new OptionType(
name: ‘Credentials’,
code: ‘credentials’,
fieldName: ‘Credentials’,
displayOrder: 2,
fieldLabel: ‘Credentials’,
required: true,
inputType: OptionType.InputType.CREDENTIAL,
dependsOn: ‘username,password’,
fieldContext: ‘config’
)
OptionType ot4 = new OptionType(
name: ‘User Name’,
code: ‘username’,
fieldName: ‘UserName’,
displayOrder: 3,
fieldLabel: ‘User Name’,
required: true,
inputType: OptionType.InputType.TEXT,
fieldContext: ‘config’
)
OptionType ot5 = new OptionType(
name: ‘Password’,
code: ‘password’,
fieldName: ‘Password’,
displayOrder: 4,
fieldLabel: ‘Password’,
required: true,
inputType: OptionType.InputType.PASSWORD,
fieldContext: ‘config’
)
OptionType ot6 = new OptionType(
name: ‘Projects’,
code: ‘projects’,
fieldName: ‘Projects’,
displayOrder: 5,
fieldLabel: ‘Projects’,
required: true,
inputType: OptionType.InputType.TEXT,
fieldContext: ‘config’
)
OptionType ot7 = new OptionType(
name: ‘Regions’,
code: ‘regions’,
fieldName: ‘Regions’,
displayOrder: 6,
fieldLabel: ‘Regions’,
required: false,
inputType: OptionType.InputType.TEXT,
fieldContext: ‘config’
)

    OptionType sep1 = new OptionType(
            name: 'Compute Service',
            code: 'compute-service',
            fieldName: 'ComputeService',
            displayOrder: 10,
            fieldLabel: 'Compute Service',
            required: false,
            inputType: OptionType.InputType.TEXT,
            fieldContext: 'config'
    )
    OptionType sep2 = new OptionType(
            name: 'Image Service',
            code: 'image-service',
            fieldName: 'ImageService',
            displayOrder: 11,
            fieldLabel: 'Image Service',
            required: false,
            inputType: OptionType.InputType.TEXT,
            fieldContext: 'config'
    )
    OptionType sep3 = new OptionType(
            name: 'Storage Service',
            code: 'storage-service',
            fieldName: 'StorageService',
            displayOrder: 12,
            fieldLabel: 'Storage Service',
            required: false,
            inputType: OptionType.InputType.TEXT,
            fieldContext: 'config'
    )
    OptionType sep4 = new OptionType(
            name: 'Network Service',
            code: 'network-service',
            fieldName: 'NetworkService',
            displayOrder: 13,
            fieldLabel: 'Network Service',
            required: false,
            inputType: OptionType.InputType.TEXT,
            fieldContext: 'config'
    )
    OptionType sep5 = new OptionType(
            name: 'Load Balancer Service',
            code: 'load-balancer-service',
            fieldName: 'LoadBalancerService',
            displayOrder: 14,
            fieldLabel: 'Load Balancer Service',
            required: false,
            inputType: OptionType.InputType.TEXT,
            fieldContext: 'config'
    )
    OptionType sep6 = new OptionType(
            name: 'Object Storage Service',
            code: 'object-storage-service',
            fieldName: 'ObjectStorageService',
            displayOrder: 15,
            fieldLabel: 'Object Storage Service',
            required: false,
            inputType: OptionType.InputType.TEXT,
            fieldContext: 'config'
    )
    OptionType sep7 = new OptionType(
            name: 'Shared File System Service',
            code: 'shared-file-system-service',
            fieldName: 'SharedFileSystemService',
            displayOrder: 16,
            fieldLabel: 'Shared File System Service',
            placeHolderText: '',
            required: false,
            inputType: OptionType.InputType.TEXT,
            fieldContext: 'config'
    )

these are optionTypes i have. I wanted to create a group and put all the service related optionTypes under that group.

I am trying like this , but when upload plugin it shows “file not found” on Morpheus

def OptionTypeGroup =[
name: ‘Service Endpoints’,
code: ‘service-group’,
displayOrder: 1,
fieldContext: ‘config’,
optionTypes: [sep1,sep2,sep3,sep4,sep5,sep6,sep7]
]

Many thanks .

Yes, I think you are right. I want to use “fieldGroup” property of optionType. how can I that can you please help.

Each OptionType that you would like to group together will need to be defined with the same fieldGroup property value.

I did that but it didn’t work for me .

thank you.