×

Please give details of the problem

Skip to content

Server-Side Javascript ES6 API Reference

RMPUser

Methods for the Management of Users

Get Application

Get the list of applications authorized to a user. This method can be used in a web interface.

Syntax :

  • RMPUser.getApplications();
  • RMPUser.getApplications(login);
  • RMPUser.getApplications(login, appContext);
  • RMPUser.getApplications(login, appContext, mode);
  • RMPUser.getApplications(login, appContext, mode, isTagged);

Parameters :

Name Type Default Description
login (optional) String current user User login/email.
appContext (optional) String web Context in which the application can be used: web, mobile or tablet.
mode (optional) String current execution mode LIVE will return the applications in LIVE version, ACCEPTANCE the applications in both LIVE and ACCEPTANCE versions, TEST will return an empty array.
isTagged (optional) Boolean false return the JSONObject representing the list of user interfaces group by tag if true

Returns : List of applications

Type : Array

Call Example :

  
    <@script env="js">  
      var res =  RMPUser.getApplications("user@runmyprocess.com")
      RMPData.setOutput(res);
    </@script>
   

Get Lanes

Get the list of lanes a user pertains to.

Get the list of lanes a user pertains to in the current execution mode context. This method can be used in a web interface. When called from a LIVE or TEST context, this method will return the list of lanes the user pertains to in LIVE. When called from an ACCEPTANCE context, this method will return the list of lanes the user pertains to in ACCEPTANCE.

Syntax : RMPUser.getLanes(login);

Parameters :

Name Type Description
login (optional) String User login/email. Default: Current user

Returns : List of Lanes

Type : Array of maps

Data structure :

  
    [{"id": "{String}", "name": "{String}"}, ...]
  

Call Example :

  
    <@script env="js">
      var res =  RMPUser.getLanes("user@runmyprocess.com");
      RMPData.setOutput(res);
    </@script>
   

Get Lane Users

Get the list of users pertaining to a lane (paginated) in the current execution mode context. When called from a LIVE or TEST context, this method will return the list of LIVE users of a lane. When called from an ACCEPTANCE context, this method will return the list of ACCEPTANCE users of a lane.

Note: Make sure that you don't exceed the allowed memory list of this function call

Syntax : RMPUser.getLaneUsers(poolId, laneId, pageSize, first);

Parameters :

Name Type Description
poolId Integer Pool/Organization identifier
laneId Integer Lane/Role identifier
pageSize Integer Number of users returned
first Integer Index for pagination

Returns : List of user's descriptors

Type : List of maps

Data Structure :

  
     {"name": "{String}", 
      "status": "{String}", 
      "login": "{String}", 
      "profile": "{String}", 
      "lang": "{String}", 
      "client_lang": "{String}", 
      "restrictions": [ {array} ],
      "i18n": "{String}",
      "alias": ["{String}", ...],  -- optional
      "delegators": [ {array} ]  -- optional
    }, ...]
   

Call Example :

  
    <@script env="js">
      var res =  RMPUser.getLaneUsers(1,5701,1,1);
      RMPData.setOutput(res);
    </@script>
   

Get Manager

Get the user's manager.

Get a manager N levels above the designed user. Only searches within a hierarchy of organizations. Only the LIVE configuration of lanes will be considered. Therefore this method's result is independent of the execution mode context.

Syntax :

  • RMPUser.getManager(login);
  • RMPUser.getManager(login, level);

Parameters :

Name Type Description
login String User login / email.
level (optional) Integer Number of levels of hierarchy. Default: 1

Throws : No manager found

Returns : Login/Email of a manager

Type : String

Call Example :

  
    <@script env="js">
      var res =  RMPUser.getManager("user@rmp.com",0);
      RMPData.setOutput(res);
    </@script>
   

Get User Data

Get a user's basic information (id, name, profile) from its login.

Syntax : RMPUser.getUserData(login);

Parameters :

Name Type Description
login String The mail ID of the recipient

Returns : Information of the given User.

Type : Map

Data Structure :

  
     {"name": "{String}", 
      "status": "{String}", 
      "login": "{String}", 
      "profile": "{String}", 
      "lang": "{String}", 
      "client_lang": "{String}", 
      "restrictions": [ {array} ],
      "i18n": "{String}",
      "alias": ["{String}", ...],  -- optional
      "delegators": [ {array} ],  -- optional
      "extended": { map }  -- optional
    }
   

Call Example :

  
    <@script env="js">
      var u = RMPUser.getUserData("john@doe.com");
    </@script>
   

Get User Lanes

Get the list of users pertaining to a lane.

Syntax : RMPUser.getUserLanes(login);

Parameters :

Name Type Description
login String The mail ID of the recipient

Returns : Role Name and Role ID.

Type : List

Data Structure :

  
     [{"id": {Long}, "name": "{String}", ...]
  

Call Example :

  
    <@script env="js">
      var ul = RMPUser.getUserLanes("john@doe.com");
    </@script>
   

Has Right In Lane

Check if a user belongs to a lane in the current execution mode context. When called from a LIVE or TEST context, this method will check the LIVE list of users of the lane. When called from an ACCEPTANCE context, this method will check the ACCEPTANCE list of users of the lane.

Syntax :

  • RMPUser.hasRightInLane(laneId);
  • RMPUser.hasRightInLane(login, laneId);

Parameters :

Name Type Description
login (optional) String User login / email. Default: current user.
laneId Integer Lane/Role identifier

Returns : true if the user belongs to the indicated lane, false if the user is not connected or if he/she does not belong to the lane

Type : Boolean

Call Example :

  
    <@script env="js">
      var res =  RMPUser.hasRightInLane("user@runmyprocess.com",5701);
      RMPData.setOutput(res);
    </@script>
   

Get User Metadata

Get the metadata of a user.

Syntax :

  • RMPUser.getUserMetaData();
  • RMPUser.getUserMetaData(login);

Parameters :

Name Type Description
login (optional) String The mail ID of the recipient. Default: current user

Returns : User Metadata

Type : Map

Call Example :

  
    <@script env="js">
      var u = RMPUser.getUserMetaData();
    </@script>
   

Save User Metadata

Modify the metadata of a user.

Syntax :

  • RMPUser.saveUserMetaData(metadata);
  • RMPUser.saveUserMetaData(login, metadata);

Parameters :

Name Type Description
login (optional) String User login/email. Current user by default
metadata Map New metadata

Returns : Login of the user

Type : String

Call Example :

  
    <@script env="js">
      var newMetadataJSON = {"name":"user", "age":22, "car":null};
      var res =  RMPUser.saveUserMetaData("user@runmyprocess.com", newMetadataJSON);
      RMPData.setOutput(res);
    </@script>
   

Get User Preferences

Get the preferences associated with a user.

Syntax : RMPUser.getUserPreferences(login);

Parameters :

Name Type Description
login (optional) String Login of the user for which the preferences shall be retrieved. Default: current user.

Returns : User's preferences

Type : Map

Call Example :

  
    <@script env="js">
      var res =  RMPUser.getUserPreferences("user@rmp.com");
      RMPData.setOutput(res);
    </@script>
   

Save User Preferences

Save the preferences associated with the current user.

Syntax : RMPUser.saveUserPreferences(userPreferences)

Parameters :

Name Type Description
userPreferences Map User's preferences

Returns : User login ID.

Type : String

Call Example :

  
    <@script env="js">
      var res =  RMPUser.saveUserPreferences({"elementTest":"DT","Login":"user"});
      RMPData.setOutput(res);
    </@script>
   

Impersonate

Impersonate another user on the same account: only allowed when the process current user is an account's admin.

Syntax : RMPUser.impersonate(login);

Parameters :

Name Type Argument Description
login String Optional Login / email of the different user to impersonate.

Throws : Impersonification is not allowed for user

Returns : Login of the impersonated user

Type : String

Call Example :

  
    <@script env="js">
      RMPUser.impersonate("someUserEmail@...");
      var md = RMPUser.getUserMetaData();
      RMPData.setOutput(md);
    </@script>