Class: ServiceCall

ServiceCall

The Service Call control is used to invoke an AJAX service which can be called On Load, or programmatically. A ServiceCall control provides the following configuration properties in Process Designer:

Formula

Input Value Formula: string

Behavior

Attached AJAX Service: The AJAX service to run when this control is executed. Takes in the Input Value as an argument for the AJAX service, and outputs the result as the bound data of this control. AJAX Service
Input Value: Value used as input of the AJAX service. Changes to this value cause an automatic invocation of the AJAX service with the updated input. ANY
Auto Run: Run on start and whenever input data changes boolean

Appearance

Busy Indicator: Busy icon to show while the service call is executing
{None | Spinner | Refresh | Cog}
string

Events

On Load:
Description: Triggers whenever the view is loaded.
Example:
me.execute(${Data1}.getValue())
On Invoked:
Description: Fires when service is invoked.
Example:
${SvcButton}.setEnabled(false);
On Result:
Description: Fires when the service returns a result.
Example:
alert("Service call returns " + me.getResult() );
On Error:
Description: Triggers when an error is returned from the service. To return an error, an AjaxError object should be used as an output variable inside the service. This can be used in conjunction with an Error Intermediate Event to catch any errors (and set the AjaxError object accordingly).
Example:
alert("Service error: " + me.getLastError().errorText)
Articles
Service Call

new ServiceCall()

This constructor is never used explicitly.

Extends

Members

Methods

execute(input)

Executes the attached AJAX service
Name Type Description
input ANY Input data for the AJAX service (type will depend on the binding type of the AJAX service)
Retrieve bound data associated this view/control. Only works for views/controls with bound data.
Returns:
Type Description
Object Value of bound data. undefined if the view has no data binding.
Example
var dec1 = MyDecimal.getData();

getInputData(){ANY}

Returns the input for this service
Returns:
Type Description
ANY Return type depends on type of attached input

getLastError(){ServiceError}

Get most recent error thrown
Returns:
Type Description
ServiceError

getResult(){ANY}

Returns the result from the attached AJAX service
Returns:
Type Description
ANY Return type depends on what is returned from the attached AJAX service

isAutoRun(){boolean}

Returns the indicator for Auto Run
Returns:
Type Description
boolean Indicates whether the service runs automatically on load and when the input value is updated
Indicates bound status of control.
Returns:
Type Description
boolean True if the control is bound to coach data.
Checks if control label is visible
Returns:
Type Description
boolean Label visibility status
Example
var labelVisible = MyView.isLabelVisible();
Returns the valid status as last set by the setValid() method.
Returns:
Type Description
boolean Validity status. true if setValid(false, ...) was never called
Example
var valid = MyView.isValid();
Propagates value change of control up through parent views
Name Type Description
event Event Value change event (usually an onchange event)
Returns:
Type Description
boolean True if a formula update was triggered on the control's parent, otherwise false
Example
MyView.propagateUp(event);

setAutoRun(flag)

Specifies whether this service runs automatically on load and whenever the input value is updated
Name Type Description
flag boolean Set to true to enable autorun for the service
Set/update bound data associated this view/control. Only works for views/controls with bound data.
Name Type Description
value Object Value of bound data. The type of this parameter must match the type of the bound data.
Example
MyView.setData("TEST"); //Updates bound data to the string 'TEST'

setInputData(data)

Specifies the default input for this service
Name Type Description
data * the input data
Show/hide the label of this view/control
Name Type Description
visible boolean Label visibility flag (true to show view label, false to hide)
Example
MyView.setLabelVisible(false);
Broadcasts the expression trigger for the specified view
Name Type Default Description
phase int bpmext.ui.PHASE_NORMAL optional The phase we are currently in
Example
MyView.triggerFormulaUpdates();