FSI API: Workflows
Executes the specified workflow.
Usage
fsi.workflow(<workflow name>, <inputs>, <outputs>, <outputVariable>, <successCallback>, <errorCallBack>, <showAjaxError>)
Definitions
{String} workflow name
{Object} inputs
{Object} outputs
{Object} outputVariable
{Functions} successCallBack, errorCallBack
{Boolean} showAjaxError
Note | Use the successCallBack function to handle output from the workflow as shown in the example below.
Example
This example executes a workflow that performs a SQL query on a data object that holds data about users and buildings. It returns a SystemId named ( BuildingId) as JSON which identifies the user's default building. The workflow takes no input parameters, and it's output parameter is defined by myResult.
A combo box is bound to the data object building name field and displays the building name corresponding to the SystemId set on it by fsi.setById().
function getDefaultBuilding() {
var inputs = {};
var outputs = {};
fsi.workflow('CLGetUserBuilding', inputs, outputs, null,
function (myResponseData) {
debugger;
var result = JSON.parse(myResponseData.myResult).Output;
fsi.setById('combo-DefaultBld', result[0].BuildingId);
},
function (errorData) { debugger; });
}
Inputs example
You build an object to supply inputs to a workflow.
In this example, a workflow has two input strings defined as WfIn1 and WfIn2. The values are being obtained from text boxes Textbox-1 and Textbox-2.
function callWorkflow(){
var outputs = {};
var inputParam1=fsi.getById('Textbox-1');
var inputParam2=fsi.getById('Textbox-2');
var inputs = {"WfIn1":inputParam1,"WfIn2":inputParam2};
fsi.workflow('MyWorkflow',inputs,outputs,null,
function (responseData) {
...
},
function (errorData) { debugger; });
}
See also Executing Workflows.