Aug 21

 Variable for Web Service

For every service imported into the app, APIs exposed by the service can be accessed. A Variable needs to be created to invoke the service and store the results of that invocation. The Variable operations are restricted by the offerings of the underlying service.

A comprehensive list of these APIs can be found from the API Designer after the import of the service.

Note: Since the service needs to be invoked to fetch the data, the widgets bound to these variables will display values only at run-time, not in Studio mode.

Variable Creation

The data source for these Variables comes from a Web Service APIs.
NOTE: Though the process for creating a variable for WebSocket Service is the same as below, properties and methods are different. See here for the WebSocket Variable.

  1. Select the Variable option from the Variable Workspace Toolbar.
  2. Click New Variable from the Variable Dialog
  3. This will initiate Create Variable wizard with the following steps:
    1. Since we are creating a variable to access Web service APIs, select Web Service as the target action
    2. Select:
      • Service – service (already imported) name,
      • Method – in case the web service exposes multiple services, you can choose from the list
      • Name – is set by default but can be modified
      • Owner – the scope of the Variable being created. By default it is set to Page, you can change it to Application if you want this variable to be available across the app
    3. Click Done to complete the variable creation process
    4. You will be directed to the Variables page, with the new variable listed.
      As you can see:

      1. a Web Service Variable is created,
      2. with the default exposed method/selected method as target
      3. the properties tab contains all the properties like behavior and spinner behavior. Know more about properties.
      4. the data tab will contain the fields serving as input fields for the API
      5. the events tab will contain the events that can be configured to trigger any action. Know more about events.


Property Description
Update data on input change If checked, the component will be triggered automatically on the change of input data (as mentioned in the data tab) for the variable.
Request data on page load If checked, ‘Page’ variable will be triggered on page load while ‘Application’ variable will be triggered on application load.
In Flight Behavior This property determines the behavior when a call is fired through the variable with the previous call still pending. Variable queues all these calls, waits for the previous call completion and then based on the value of the inFlightBehavior property, decides what to do with all the queued calls:

  • doNotExecute – all the queued calls will be discarded,
  • executeAll – all the calls will be triggered one by one, or
  • executeLast – only the last call is triggered and the rest are discarded, this is the default behavior
Spinner Context This property specifies on which UI widget the spinner should show. Leave empty if no spinner required.
Spinner Message The message to be displayed below the spinner. Leave empty if no message is required below the spinner.
Note: If multiple variables are fired then the spinner messages will be displayed as a list below a single spinner.


During the life cycle of a Variable, a set of events are emitted by the Variable, thus giving you the option to control the behavior of the Variable such as input data validations, data processing, success/error handling, etc. Know More.


Few Methods are exposed for Variables which can be used for achieving more control and accessing extra functionality. Listed here are the same.


This method updates the Variable’s dataSet with new data by making a call to the target service.


  • options(object) – It can have fields as:
    • inputFields(key-value pair of inputData)
    • page(pagination for Query Service Variable)
    • size(pagination for Query Service Variable)
    • orderBy(pagination for Query Service Variable)
  • success(callback)
  • error(callback)

Return Value:



This method aborts the current inflight variable request.

Return Value:



This method returns the variable’s dataSet, i.e., the current data stored in the variable through the listrecords method.


Return Value:
Array of record objects



This method clears the variable dataSet.


Return Value:
Updated(empty) dataSet of the variable


setInput(key, value)

This method sets the input field value against the specified field(key).


  • key(string): name of the input field
  • value(*): value for the input field

Return Value:
Updated inputFields object



This method can also be used to set all the specified key-value pairs as input fields in the variable.

inputData(object) object or key-value pairs {“key”: “value”,…}

Return Value:
Updated inputFields object


We use cookies to provide you with a better experience. By using our website you agree to the use of cookies as described in our Privacy Policy.