×

Please give details of the problem

Skip to content

Server-Side Javascript ES6 API Reference

RMPRequest

Methods for the Management of Requests

Add User To Lane

Add a user to the given runtime lane.

Syntax : RMPRequest.addUserToLane(laneId, userId)

Parameters :

Name Type Description
laneId Integer Identifier of the lane
userId Integer Id or login of the user

Returns : Status if adding a user to the lane.

Type : Boolean

Call Example :

  
    <@script env="js">
      var j = RMPRequest.addUserToLane(53877772,65914367);
      RMPData.setOutput(j);
    </@script>
   

Get Next URL

Return the URL of a manual task. Provides the URL of a manual task that will be generated when reaching the step stepId. This method can be called outside a manual task's input parameters. In a loop, the returned URL will be set for the next iteration.

Syntax :

  • RMPRequest.getNextUrl(stepId, isPublic)
  • RMPRequest.getNextUrl(stepId, isPublic, appCtx)

Parameters :

Name Type Description
stepId Integer The id of the step as defined in the process design
isPublic Boolean Use a public task template or not
appCtx (optional) String If context=mobile, the generated URL will be adapted to the RunMyApp environment. Default: web

Returns : Task URL

Type : String

Call Example 1 :

  
    <@script env="js">
      var f = RMPRequest.getNextUrl(2,false,"mobile");
      RMPData.setOutput(f);
    </@script>
   

Call Example 2 :

  
    <@script env="js">
      var f = RMPRequest.getNextUrl(2, false);
      RMPData.setOutput(f);
    </@script>
   

Get Request Info

Describe a process request.

Syntax :

  • RMPRequest.getRequestInfo();
  • RMPRequest.getRequestInfo(requestId);

Parameters :

Name Type Description
requestId (optional) String Identifier of the process request to describe. Default: current process request

Returns : Process request descriptor.

Type : Object

Call Example :

  
    <@script env="js">
      var f = RMPRequest.getRequestInfo("fcb7a691-38bd-4b26-b1a7-82cca9d6ecf0");
      RMPData.setOutput(f);
    </@script>
   

Get Task URL

Return the URL of the current manual task. When used within a manual task's input parameters, provides the URL of the manual task to be generated.

Syntax : RMPRequest.getTaskUrl(isPublic);

Parameters :

Name Type Description
isPublic Boolean Use a public task template or not

Returns : Task URL.

Type : String

Call Example :

  
    <@script env="js">
      var j = RMPRequest.getTaskUrl(true);
      RMPData.setOutput(j);
    </@script>
   

Inject Params

Add the result of the last executed task to the context of a process request.

Syntax : RMPRequest.injectParams();

Parameters : None

Returns : Result of the last executed task.

Type : String

Call Example :

  
    <@script env="js">
      var f = RMPRequest.injectParams();
      RMPData.setOutput(f);
    </@script>
   

Lock

Lock a resource.

Create a global lock on a customer account to avoid concurrency when accessing a shared resource. This waits for the obtention of the lock if a lock with the same name already exists.

Datadocument: The use of the method R_lock and/or R_unlock will add in the internal parameter a JSONArray with the key P_locks

Syntax :

  • RMPRequest.lock(lockName)
  • RMPRequest.lock(lockName, timeoutInMs)
  • RMPRequest.lock(lockName, timeoutInMs, expirationInSecs)

Parameters :

Name Type Description
lockName String Name of the lock
timeoutInMs (optional) Long Maximum time to wait to get the lock in milliseconds up to maximum of 40000ms
expirationInSecs (optional) Long Maximum time the lock could be kept if not released programmatically (in seconds). Default: 1 hour.

Throws : Timeout exception if the request doesn't get the lock

Returns : Status of the lock, lock acquired or not

Type : Boolean

Call Example :

  
    <@script env="js">
      var state = "ok";
      var f = RMPRequest.lock("test", 10000);
      if (f) {
        RMPRequest.unlock("test");
      } else {
        state= "nok";
      }
      RMPData.setOutput(state);
    </@script>
   

Unlock

Release a lock acquired with RMPRequest.lock().

Datadocument: The use of the method lock and/or unlock will add in the internal parameter a JSONArray with the key P_locks

Syntax : RMPRequest.unlock(lockName)

Returns : None

Call Example :

  
    <@script env="js">
      var state = "ok";
      var f = RMPRequest.lock("test", 10000);
      if (f) {
        RMPRequest.unlock("test");
      } else {
        state= "nok";
      }
      RMPData.setOutput(state);
    </@script>
   

Raise Error

Return the URL of the current manual task. When used within a manual task's input parameters, provides the URL of the manual task to be generated.

Syntax : RMPRequest.raiseError(errorMessage);

Parameters :

Name Type Description
errorMessage string Error message

Throws : An error(ScriptExecutionException) with the given error messageTask URL.

Call Example :

  
    <@script env="js">
      var j = RMPRequest.raiseError(true);
      RMPData.setOutput(j);
    </@script>
   

Read File Add Lane with (fileIds, laneIds)

Add lanes allowed to READ the file(s).

Syntax : RMPRequest.readFileAddLane(fileIds, laneIds);

Parameters :

Name Type Description
fileIds Array a list of file identifiers.
laneIds Array a list of file identifiers.

Returns : The list of lanes and users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.readFileAddLane(["fb090250-b571-4aba-a25a-77a996fe72ee"],[53762810]);
      RMPData.setOutput(j);
    </@script>
   

Read File Add Lane with (fileIds)

Add current request lanes allowed to READ the file(s).

Syntax : RMPRequest.readFileAddLane(fileIds);

Parameters :

Name Type Description
fileIds Array a list of file identifiers.

Returns : The list of users and current lane with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.readFileAddLane(["fb090250-b571-4aba-a25a-77a996fe72ee"]);
      RMPData.setOutput(j);
    </@script>
   

Read File Add User with (fileIds, userIds)

Add users allowed to READ the file(s).

Syntax : RMPRequest.readFileAddUser(fileIds, userIds);

Parameters :

Name Type Description
fileIds Array a list of file identifiers.
userIds Array a list of either user identifiers or user logins

Returns : The list of lanes and users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.readFileAddUser(["fb090250-b571-4aba-a25a-77a996fe72ee"],[66021605]);
      RMPData.setOutput(j);
    </@script>
   

Read File Add User with (fileIds)

Add connected/login user allowed to READ the file(s).

Syntax : RMPRequest.readFileAddUser(fileIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.

Returns : The list of lanes and login user with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.readFileAddUser(["fb090250-b571-4aba-a25a-77a996fe72ee"]);
      RMPData.setOutput(j);
    </@script>
   

Read File Remove Lane with (fileIds, laneIds)

Remove lanes allowed to READ the file(s).

Syntax : RMPRequest.readFileRemoveLane(fileIds, laneIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.
laneIds Array a list of lane identifiers.

Returns : The list of lanes and users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.readFileRemoveLane(["03acf9f2-609f-4cb4-bcbe-17e4005e1fea"],[53818190]);
      RMPData.setOutput(j);
    </@script>
   

Read File Remove Lane with (fileIds)

Remove the current lane(lane of the request) allowed to READ the file(s).

Syntax : RMPRequest.readFileRemoveLane(fileIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.

Returns : The list of users and lane of the request with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.readFileRemoveLane(["03acf9f2-609f-4cb4-bcbe-17e4005e1fea"]);
      RMPData.setOutput(j);
    </@script>
   

Read File Remove User with (fileIds)

Remove connected/login user allowed to READ the file(s).

Syntax : RMPRequest.readFileRemoveUser(fileIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.

Returns : The list of lanes and login users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.readFileRemoveUser(["fb090250-b571-4aba-a25a-77a996fe72ee"]);
      RMPData.setOutput(j);
    </@script>
   

Read File Remove User with (fileIds, userIds)

Remove users allowed to READ the file(s).

Syntax : RMPRequest.readFileRemoveUser(fileIds, userIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.
laneIds Array a list of either user identifiers or user logins

Returns : The list of lanes and users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.readFileRemoveUser(["fb090250-b571-4aba-a25a-77a996fe72ee"],[66021605]);
      RMPData.setOutput(j);
    </@script>
   

Remove User From Lane

Remove a user from the given runtime lane.

Syntax : RMPRequest.removeUserFromLane(laneId, userId);

Parameters :

Name Type Description
laneId Integer Identifier of the lane.
userId Integer Id or login of the user

Returns : status if adding a user to the lane.

Type : Boolean

Call Example :

  
    <@script env="js">  
      var f = RMPRequest.removeUserFromLane(53877772,65914367);
      RMPData.setOutput(f);
    </@script>
   

Set Request Status

Set the status of the current request to the status code.

Syntax : RMPRequest.setRequestStatus(statusCode);

Parameters :

Name Type Description
statusCode Integer 102/201/301/302/400/401

Returns : True if status updates else false

Type : Boolean

Call Example :

  
    <@script env="js">
      var j = RMPRequest.setRequestStatus(200);
      RMPData.setOutput(j);
    </@script>
   

Update File Add Lane with (fileIds)

Add current lane(lane of the request) allowed to WRITE/DELETE the file(s).

Syntax : RMPRequest.updateFileAddLane(fileIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.

Returns : The list of users and lane of the current request with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.updateFileAddLane(["fb090250-b571-4aba-a25a-77a996fe72ee"]); RMPData.setOutput(j);
    </@script>
   

Update File Add Lane with (fileIds, laneIds)

Add lanes allowed to WRITE/DELETE the file(s).

Syntax : RMPRequest.updateFileAddLane(fileIds, laneIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.
laneIds Array a list of lane identifiers.

Returns : The list of lanes and users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.updateFileAddLane(["fb090250-b571-4aba-a25a-77a996fe72ee"],[53762810]);
      RMPData.setOutput(j);
    </@script>
   

Update File Add User with (fileIds, userIds)

Add users allowed to WRITE/DELETE the file(s).

Syntax : RMPRequest.updateFileAddUser(fileIds, userIds);

Parameters :

Name Type Description
fileIds Array a list of file identifiers.
userIds Array a list of either user identifiers or user logins

Returns : The list of lanes and users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.updateFileAddUser(["fb090250-b571-4aba-a25a-77a996fe72ee"],[66021605]);
      RMPData.setOutput(j);
    </@script>
   

Update File Add User with (fileIds)

Add connected/login user allowed to WRITE/DELETE the file(s).

Syntax : RMPRequest.updateFileAddUser(fileIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.

Returns : The list of lanes and login users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.updateFileAddUser(["fb090250-b571-4aba-a25a-77a996fe72ee"]);
      RMPData.setOutput(j);
    </@script>
   

Update File Remove Lane with (fileIds, laneIds)

Remove lanes allowed to WRITE/DELETE the file(s).

Syntax : RMPRequest.updateFileRemoveLane(fileIds, laneIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.
laneIds Array a list of lane identifiers.

Returns : The list of lanes and users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.updateFileRemoveLane(["03acf9f2-609f-4cb4-bcbe-17e4005e1fea"],[53818190]);
      RMPData.setOutput(j);
    </@script>
   

Update File Remove Lane with (fileIds)

Remove the current lane(lane of the request) allowed to WRITE/DELETE the file(s).

Syntax : RMPRequest.updateFileRemoveLane(fileIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.

Returns : The list of users and lane of the request with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
  

Call Example :

  
    <@script env="js">
      var j = RMPRequest.updateFileRemoveLane(["03acf9f2-609f-4cb4-bcbe-17e4005e1fea"]);
      RMPData.setOutput(j);
    </@script>
   

Update File Remove User with (fileIds, userIds)

Remove users allowed to WRITE/DELETE the file(s).

Syntax : RMPRequest.updateFileRemoveUser(fileIds, userIds);

Parameters :

Name Type Description
fileIds Array a list of file identifiers.
userIds Array a list of either user identifiers or user logins

Returns : The list of lanes and users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.updateFileRemoveUser(["fb090250-b571-4aba-a25a-77a996fe72ee"],[66021605]);
      RMPData.setOutput(j);
    </@script>
   

Update File Remove User with (fileIds)

Remove connected/login user allowed to WRITE/DELETE the file(s).

Syntax : RMPRequest.updateFileRemoveUser(fileIds);

Parameters :

Name Type Description
fileIds Array a list of files identifiers.

Returns : The list of lanes and login users with the appropriate right for each file in JSON

Type : Map

Data Structure :

  
    {"user":{"READ":[array(Long)], "WRITE":[array(Long)]}, "lane":{"READ":[array(Long)], "WRITE":[array(Long)]}}
   

Call Example :

  
    <@script env="js">
      var j = RMPRequest.updateFileRemoveUser(["fb090250-b571-4aba-a25a-77a996fe72ee"]);
      RMPData.setOutput(j);
    </@script>