Building a dynamic select option list
To build a dynamic select option list
Select the Callback tab in the Options section.
Select the appropriate callback from the Callback name dropdown.
Note
As with all callbacks, you must have already created the callback. You must also write code for the CyberApp callback handler to handle the callback. The response payload must include an array of items.
[If the callback requires UI data for the request payload] Map the callback request payload.
The three select options fields for mapping the callback response array are Name (equates to the Label field in Static options), Value, and Comment.Important
The three mappable fields of a select element can only be mapped with properties from a single array in the response payload: you cannot map them across two or three different arrays. Name and Comment can only be mapped to string types. Value can be mapped to a string or a number type.
Tip
You can automatically pre-select a value by creating an input parameter with the desired pre-select value and the same ID as the select element.
Example
In this example, the user chooses the policy they want to apply to the tenant through a select element. A callback named GetTenantPolicies retrieves the possible policies for the tenant from the ISV cloud service. To refine the search, we pass the Acronis tenant_id
to the service as the callback request payload. To map this value to the callback request, we create an input parameter for the Root form, and assign it the value of the Acronis system variable.
tenantid
input parameter (which has been assigned the value of the Acronis tenant_id
variable) to the callback request property tenantcode
.
the callback response property
policydescription
to the select’s Comment field.the callback response property
policycode
(which is a number) to the select’s Value field.the callback response property
policyname
to the select’s Name field.
Note
The request and response payload of the GetTenantPolices callback at listed at the bottom of the page.
The GetTenantPolicies callback
GetTenantPolicies callback has the following request payload:
{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema",
"properties": {
"items": {
"type": "object",
"properties": {
"tenantcode": {
"type": "string"
}
}
}
}
}
GetTenantPolicies callback has the following response payload:
{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"policycode": {
"type": "number"
},
"policyname": {
"type": "string"
},
"policydescription": {
"type": "string"
}
}
}
}
}
}