Using Input Parameters
Using Input Parameters
Views can pass input parameters to services, mainly to specify:
- the values entered or changed by the user, such as form field values
- the parameters that affect the workflow rule behavior, such as a flag to enable or disable email notification.
Service methods can declare input parameters as shown in the example below:
public void approveAction(String assignedTo, double costEstimated) {
...
}
JavaScript code can send the input parameters as follows:
try{
var result = Workflow.call('AbSolutionsViewExamples-LogicExamples-approveAction', assignedTo, costEstimated);
} catch (e) {
Workflow.handleError(e);
}
Although all
input parameter values are passed to the service method via the HTTP request as strings, Web Central will convert them to Java types, as declared in the service method signature. You can use input parameters of the following types:
- Simple values :
- int : integer value;
- double : double-precision floating-point value;
- boolean : boolean value;
- String : string value;
- Date and time values : all date and time values should be sent from the view as JavaScript Date objects;
- java.util.Date : date value;
- java.sql.Date : date value; the java.util.Date is the preferred type for date parameters;
- java.sql.Time : time value;
- DataRecord : contains field values from a form, a console, or a selected grid row; can be sent from JavaScript as an Ab.data.Record object.
- List : contains String values; can be sent from JavaScript as an array;
- Map : contains String keys and String values; can be sent from JavaScript as a simple JSON object;
- JSONObject : a container for complex parameter values, possibly with nested arrays or objects; you will rarely need to use such a parameter.