The JavaScript function written for a Custom Service can return either a simple single value or a single JSON object / JSON array. The Response page of the New Custom Integration Point wizard allows you to map this response to one or more variables that can be accessed by users who are building Interaction flows using the Interaction Designer.

Note: For more information about how Integration Points are used in the Interaction Designer, click here.

The root element of the data returned is always called response. (This is the term displayed in the Parameter Name column.) Mapping the response involves selecting the appropriate variable type and specifying a the variable name to be displayed in the Interaction Designer.

Response mapping can be done in either of the following ways:

  • Mapping the result into one or more simple variables
  • Mapping the result into a custom variable type (object)

Mapping into Simple Variables

This technique can be used for any type of response (single value or object). When possible, parsing an object response into simple variables is recommended, as it is easier for users of the Interaction Designer to work with separate variables.

To map a simple value:

  1. In the Parameter Name column, do not change the default value. (The name should be response.)
  2. From the Variable Type dropdown, select the appropriate parameter type. If you select a collection, specify the type from the Type dropdown list.
  3. In the Variable Name column, enter a meaningful name for the variable. The name assigned in this column is the one displayed to users in the Interaction Designer.

To map an object into simple variables:

  1. In the Parameter Name column, specify a field of the object using the following notation: response.fieldname. This will parse the response into a single variable.

    Note: The text following the period needs to be an exact match to the data that is returned in the JSON response.

    In the following example, the returned object contains two fields: city and temp.

  2. From the Variable Type dropdown, select the appropriate parameter type. 
  3. In the Variable Name column, enter a meaningful name for the variable. The name assigned in this column is the one displayed to users in the Interaction Designer.
  4. Repeat Steps 1-3 until all fields of the object are mapped to variables.

Mapping into a Custom Variable Type

A custom variable type is a variable that contains a set of fields related to a specific object. (For example, a custom variable type representing a Customer object would contain fields such as First Name, Last Name, Address, Age, and so on.)

Existing custom variable types are listed at the end of the Variable Type dropdown list. To map a returned JSON object or array into a custom variable type, select the type from the list, or create a new custom variable type that is relevant to the response.

To map an object to a custom variable type:

  1. In the Parameter Name column, do not change the default value. (The name should be response.)
  2. From the Variable Type dropdown, select the appropriate custom variable type. Alternatively, create a new custom variable type. For details, refer to Working with Custom Types in REST IP Responses.
  3. In the Variable Name column, enter a meaningful name for the variable. The name assigned in this column is the one displayed to users in the Interaction Designer.

 

Revision:

Comments