Defining response mapping

When a callback is sent to the callback handler, the response can include data which should be displayed by form elements and/or stored in form input parameters.
Response mapping specifies how the data received in the callback response payload is mapped to the form model.

Note

Data initializer callbacks are a common form of response mapping.

To define response mapping

Note

You do not need to map all response data. If you want to ignore some data, you can simply not map it.
  1. Click add in the Response mapping section.

    ../../../../_images/ss-uibuilder-responsemapping.png
  2. Select a callback response payload data item from the Callback dropdown list, and the form model UI element or input property you want to map it to from the Model dropdown list.

    Note

    Callback and Model dropdown entry data types must match or you cannot select the dropdown entry.
    You must add the necessary UI elements and/or add the necessary input parameters for them to appear in the dropdown.
    If you make a mistake, you can change the selected items or click the delete button to delete the mapping.
  3. Repeat step 2 for all the callback response payload data items you want to display in the UI elements or store as input parameters.

Example

In the following example, a table which lists users is populated by a data initializer callback.
The table has a Get machine action button. This action button is available only when the user selects a single row.
When the user clicks Get machine, the CyberApp sends a callback named GetMachineInfo the callback handler.
../../../../_images/ss-uibuilder-responsemapping1.png

The request payload of the GetMachineInfo callback supplies the callback handler with the userid from the selected table row:

{
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema",
  "properties": {
    "userid": {
      "type": "string"
    }
  }
}

The response payload of the GetMachineInfo callback supplies the CyberApp with user machine details from the ISV cloud service:

{
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema",
  "properties": {
    "username": {
      "type": "string"
    },
    "machineid": {
      "type": "integer"
    },
    "machineos": {
      "type": "string"
    },
    "machinemake": {
      "type": "string"
    },
    "machinemodel": {
      "type": "string"
    }
  }
}
The CyberApp developer maps the response payload data items to the form model in order to display them to the user.

In the following illustration, the developer has already mapped three elements on the form. However, when the developer tries to map the fourth element (MID), the mapping is not possible because the property type in the payload does not match the form element type.
The developer changes the form element type and tries again. This time, they are able to map.
../../../../_images/ss-response-mapping.gif