Process Services APIs

The script task in process model allows to add custom script including APIs which provide various functionality such as add variables to process memory and get files from process memory. You can use the process services APIs in server script that you add in Script Task an any other task which has On Before or On After options in a process model.

Following Process Services APIs are currently available with ASG-Studio:

Add Memory Variable

This API when executed adds a variable to the memory of process instance.

Syntax: $pm.addMemVariable(key , value)

Parameters:

  • key: (string) The variable that is specified as key.
  • value: (object) The value that is to be used for the key.

Example:

var loanValue= 4 + 20;

$pm.addMemVariable("loanamount", loanValue);

Get File

This API when executed returns a Map object to the specified variable.

Syntax: $pm.getFile(<ID>);

Parameters:

  • ID: The reference variable to get the file.

The Map that is returned after executing this APIs includes the following keys:

  • filename: specifies the name of the file.
  • filename: specifies the name of the file.
  • filename: specifies the name of the file.

Example:

$pm.getFile(<ID>).get(“filecontent”);

Get Files

This function when executed returns a list of Map object to the specified variable.

Syntax: $pm.getFiles(<collection_key>);

Prameters:

  • collection_key: The reference variable to get the files.