ScriptCall.call(scriptID, params, body, bodyMimeType)
Invokes another script.
Parameters
call has the following parameters:
Parameters | Description |
---|---|
scriptID | ID of the script to invoke. Script alias can be specified instead of ID. |
params | Parameters to pass to the script. In JSON format. |
body | Body content to pass to the script. |
bodyMimeType | Content type of the body parameter. |
Example
This example shows calling a script from another script.
var greeting = request.get("greeting");
var person = request.get("person");
var hello = greeting + ", " + person;
// request.body is read and passed back to the calling script.
Apperyio.response.success({"msg":greeting, "info":request.body()}, "application/json");
// Invoke Script #1
var result = ScriptCall.call("55d4c897-4cea-57ab-800b-473f74e5885a", {"greeting":"Hello", "person":"Jenny"}, "A greeting script - nice.", "plain/text");
Apperyio.response.success(result.body, "application/json");
{
"msg": "Hello",
"info": "A greeting script - nice."
}