- RunMyScript (RMS)
- Workflow Steps
- Supported Custom Functions
- RMPApplication
- RMPCollections
- 7. Aggregate
- 8. Count Documents
- 9. Create Collection
- 10. Create Index
- 11. Delete Index
- 12. Import CSV
- 13. Import JSON
- 14. List
- 15. List Index
- 16. Remove Collection
- 17. Remove Field
- 18. Remove Objects
- 19. Rename Collection
- 20. Save Object
- 21. Save Objects
- 22. Update Field (updateMany)
- 23. Update Field (updateOne)
- 24. Update Objects
- RMPData
- RMPFile
- RMPProject
- RMPRequest
- 60. Add User To Lane
- 61. Get Next URL
- 62. Get Request Info
- 63. Get Task URL
- 64. Inject Params
- 65. Lock
- 66. Raise Error
- 67. Read File Add Lane with (fileIds, laneIds)
- 68. Read File Add Lane with (fileIds)
- 69. Read File Add User with (fileIds, userIds)
- 70. Read File Add User with (fileIds)
- 71. Read File Remove Lane with (fileIds, laneIds)
- 72. Read File Remove Lane with (fileIds)
- 73. Read File Remove User with (fileIds)
- 74. Read File Remove User with (fileIds, userIds)
- 75. Remove User From Lane
- 76. Set Request Status
- 77. Unlock
- 78. Update File Add Lane with (fileIds)
- 79. Update File Add Lane with (fileIds, laneIds)
- 80. Update File Add User with (fileIds, userIds)
- 81. Update File Add User with (fileIds)
- 82. Update File Remove Lane with (fileIds, laneIds)
- 83. Update File Remove Lane with (fileIds)
- 84. Update File Remove User with (fileIds, userIds)
- 85. Update File Remove User with (fileIds)
- RMPUser
- RMPUtilities
RunMyScript (RMS)
Introducing RunMyScript (RMS), a new scripting engine designed to elevate the functionality and capabilities of our application, allows you to execute custom JavaScript functions seamlessly alongside Freemarker functions.
This section will walk you through the essential steps and concepts of using RMS, and help you streamline your workflow, whether you're looking to automate tasks, extend functionality, or solve complex problems.
Workflow Steps
Basic Script Setup
The new engine can be triggered when specifying a script like this (e.g. as input/output parameters of a process):
1 2 3 |
|
Please note that compared to the existing engine, you have to specify <@script env="js"> rather than <@script env="javascript">
Besides the standard Javascript language, there are a number of RMP Objects which provide access to custom functions. Namely: - RMPApplication - application-centric functions - RMPCollection - access to customer MongoDB collections - RMPData - response data handling - RMPFile - access to files (S3 bucket) - RMPProject - - RMPRequest - process-request centric functions (also lock/unlock) - RMPUser - user-centric functions - RMPUtilities - some useful helper functions
The basic usage is like
1 2 3 |
|
Broadly, these custom functions resemble those from the Freemarker environment.
Response Handling
There are 2 ways for returning data to the caller (e.g. a process).
The response object has to be an Object that can be translated into a String. Namely: - String - Number - Boolean - JSONObject - JSONArray
Option 1:
You can specify the response explicitly via the custom function below.
1 2 3 |
|
Option 2:
You can implement a function that returns the value.
1 2 3 |
|
Saving Data into the Process Context
1 2 3 4 5 |
|
JS Engine vs Freemarker Equivalence
Freemarker:
1 2 |
|
So you use the <#assign x=y> for assigning a value to a variable.
${x} is used to return the variable value to the workflow / app.
You may also spot the following variation:
1 2 3 4 |
|
JS (Option 1 in chapter Response Handling):
1 2 3 4 |
|
var x = y; is a standard JS value assignment.
User RMPData.setOutput(x); for returning the variable value to the workflow / app.
Supported Custom Functions
RMPApplication
Methods for Application
1. Attach File
Find the last occurrence of a string in a file.
Syntax : RMPApplication.attachFile(fileIds, widgetId);
Parameters :
Name | Type | Argument | Description |
---|---|---|---|
fileID | String / Array | The variable of an uploaded file widget, containing one file identifier or a list of file identifiers | |
file widgetID | String | optional | Identifier of the uploaded file widget to which the file(s) should be attached. Necessary if several uploaded file widgets are present in the application. |
Returns : Descriptors of the attached files.
Type : Array
Example :
1 2 3 4 5 |
|
2. Detach File
Detach a file or a list of files from an application.
Syntax : RMPApplication.detachFile(fileIds,instanceId);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String / Array | One file identifier or a list of file identifiers in a JSONArray format or the variable of an uploaded file widget |
instanceId | String | Application instance from which the file(s) shall be detached. |
Returns : Descriptors of the detached files.
Type : Array
Example :
1 2 3 4 5 6 |
|
3. Get History
Get the history of modifications of application instances during a process, just as the history widget would do it.
Syntax : RMPApplication.getHistory();
Parameters : None
Returns : Array of history metadata.
Type : Array
Example :
1 2 3 |
|
4. Get Instance Info
Get the metadata describing an application instance.
Syntax : RMPApplication.getInstanceInfo(instanceId);
Parameters :
Name | Type | Description |
---|---|---|
instanceId | String | Application instance. |
Returns : Application instance description.
Type : Application metadata
Example :
1 2 3 |
|
5. GetI18n
Internationalization method. Get the translation of a key in a given language. With this method, you can enforce the language type. It applies to all process activities, not only to email activities.
Syntax : RMPApplication.getI18n(key, defaultValue, language)
Parameters :
Name | Type | Argument | Description |
---|---|---|---|
key | String | - | - |
defaultValue | String | - | Default value if key is not found in language |
language | String | Optional | Language code (two letters) |
Returns : Target translation or defaultValue if nothing is found.
Type : String
Example :
1 2 3 4 |
|
6. List Attached Files
List the files attached to an application.
Syntax : RMPApplication.listAttachedFiles(instanceId);
Parameters :
Name | Type | Description |
---|---|---|
instanceId | String | Application instance. |
Returns : Descriptors of the attached files.
Type : Array
Example :
1 2 3 4 5 |
|
RMPCollections
Methods for Collections
7. Aggregate
Run an aggregation query over a collection
Syntax : RMPCollection.aggregate(collectionName, pipelines);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
pipelines | List (Map) | An aggregation requires at least one pipeline |
Returns : The result of the aggregate operation
Type : List (Map)
Example :
1 2 3 4 5 |
|
8. Count Documents
Count documents verifying a condition in a collection
Syntax : RMPCollection.countDocuments(collectionName, query);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
query | Map | Query to filter objects to be retrieved |
Returns : The number of documents matching the query
Type : Long
Example :
1 2 3 4 5 |
|
9. Create Collection
Creates a new collection
Syntax : RMPCollection.createCollection(collectionName, isPublic, isReadonly);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
isPublic | Boolean | If true the collection can be accessed publicly, without checking rights |
isReadonly | Boolean | If true the collection can only be modified by an administrator of the customer account |
Returns : Collection successfully created or not
Type : Boolean
Example :
1 2 3 4 |
|
10. Create Index
Creates indexes on collection
Syntax : RMPCollection.createIndex(collectionName, indexName, indexArray);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
indexName | String | Name of the Index |
indexArray | List (String) | Index Array |
Returns : The result of the create operation (true or false)
Type : Boolean
Example :
1 2 3 4 5 |
|
11. Delete Index
Remove an index on a collection
Syntax : RMPCollection.dropIndex(collectionName, indexName);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
indexName | String | Name of the Index |
Returns : The result of the delete operation (true or false)
Type : Boolean
Example :
1 2 3 4 |
|
12. Import CSV
Import objects in a collection from a CSV file
Syntax : RMPCollection.importCSV(fileId, collectionName, options);
Parameters :
Name | Type | Description |
---|---|---|
fileId | String | Reference of an uploaded file |
collectionName | String | Name of the collection |
options | Object | Options to be used during the call, all values are optional |
Name | Type | Argument | Default | Description |
---|---|---|---|---|
separator | String | , | Separator between two values (for example ; or , ) |
|
delimiter | String | " | Delimiter used to allow values containing the separator character (for example " or ' ), to include a delimiter in a value, use two delimiters ("" for example) |
|
empty | String | "" | Value to be used to represent an empty value (two separators in a row) | |
charset | String | UTF-8 | Character set to be used to read the file content. | |
parse_numbers | Array | Array of names or indices (zero based) of columns containing numerical values that should be stored as numbers (double). Examples : ["age",3] is asking the loader to parse column with header "age" and the fourth column |
||
parse_longs | Array | Array of names or indices (zero based) of columns containing long values that should be stored as longs. Examples : ["age",3] is asking the loader to parse column with header "age" and the fourth column. |
||
trim | boolean | true to trim values before inserting them in the collection. The trimmed value will be the parsed value, with any leading and trailing whitespace removed. Trimming also occurs before decoding numerical values. false to keep values unchanged. |
Throws : Uploaded file X doesn't exist.
Returns : The number of imported objects.
Type : Integer
Example :
1 2 3 4 5 |
|
13. Import JSON
Import objects in a collection from a JSON file.
Syntax : RMPCollection.importJSON(fileId, collectionName, options);
Parameters :
Name | Type | Description |
---|---|---|
fileId | String | Reference of an uploaded file |
collectionName | String | Name of the collection |
options | Object | Options to be used during the call, all values are optional |
Name | Type | Argument | Default | Description |
---|---|---|---|---|
separator | String | , | Separator between two values (for example ; or , ) |
|
delimiter | String | " | Delimiter used to allow values containing the separator character (for example " or ' ), to include a delimiter in a value, use two delimiters ("" for example) |
|
empty | String | "" | Value to be used to represent an empty value (two separators in a row) | |
charset | String | UTF-8 | Character set to be used to read the file content. | |
parse_numbers | Array | Array of names or indices (zero based) of columns containing numerical values that should be stored as numbers (double). Examples : ["age",3] is asking the loader to parse column with header "age" and the fourth column |
||
parse_longs | Array | Array of names or indices (zero based) of columns containing long values that should be stored as longs. Examples : ["age",3] is asking the loader to parse column with header "age" and the fourth column. |
||
trim | boolean | true to trim values before inserting them in the collection. The trimmed value will be the parsed value, with any leading and trailing whitespace removed. Trimming also occurs before decoding numerical values. false to keep values unchanged. |
Throws : Uploaded file X doesn't exist.
Returns : The number of imported objects.
Type : Integer
Example :
1 2 3 4 5 |
|
14. List
Retrieve objects from a collection
Syntax : RMPCollection.find(collectionName, query);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
query | Map | Query to filter objects to be retrieved. |
Returns : List of objects
Type : List (Map)
Example :
1 2 3 4 5 |
|
15. List Index
List of all indexes on a collection
Syntax : RMPCollection.listIndexes(collectionName);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
Returns : List of indexes
Type : List (Map)
Example :
1 2 3 4 |
|
16. Remove Collection
Remove a collection
Syntax : RMPCollection.drop(collectionName);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of a collection |
Returns : Collection successfully removed or not
Type : Boolean
Example :
1 2 3 4 |
|
17. Remove Field
Remove a field from documents that matches with the given query
Syntax : RMPCollection.deleteField(collectionName, query, fieldName);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of a collection |
query | Map | Query to filter objects to be retrieved |
fieldName | String | Name of the field |
Returns : Number of updated objects
Type : Integer
Example :
1 2 3 4 5 |
|
18. Remove Objects
Remove fields from documents that matches with the given query
Syntax : RMPCollection.deleteMany(collectionName, query);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of a collection |
query | Map | Query to filter objects to be retrieved |
Returns : Number of removed objects
Type : Integer
Example :
1 2 3 4 5 |
|
19. Rename Collection
Rename a collection
Syntax : RMPCollection.renameCollection(oldCollectionName, newCollectionName);
Parameters :
Name | Type | Description |
---|---|---|
oldcollectionName | String | Current name of the collection |
newcollectionName | String | New name of the collection |
Returns : Renaming successful or not.
1 |
|
Type : Boolean
Example :
1 2 3 4 |
|
20. Save Object
Insert object in a collection
Syntax : RMPCollection.insertOne(collectionName, data);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
data | Map | Data to store in a collection |
Returns : The saved data
Type : Map
Example :
1 2 3 4 5 |
|
21. Save Objects
Insert many objects in a collection
Syntax : RMPCollection.insertMany(collectionName, data);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
data | List (Map) | Data to store in a collection |
Returns : The saved data
Type : List (Map)
Example :
1 2 3 4 5 |
|
22. Update Field (updateMany)
Update fields on a subset of the documents in a collection
Syntax : RMPCollection.updateField(collectionName, query, data, multipleDocuments);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
query | Map | Query to filter objects to be retrieved |
data | Map | Data to be updated in a collection |
multipleDocuments | Boolean | True if multiple documents have to be updated |
Returns : Number of updated fields
Type : Integer
Example :
1 2 3 4 5 6 |
|
23. Update Field (updateOne)
Update a field on a subset of the documents in a collection
Syntax : RMPCollection.updateField(collectionName, query, data);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
query | Map | Query to filter objects to be retrieved |
data | Map | Data to be updated in a collection |
Returns : Number of updated fields
Type : Integer
Example :
1 2 3 4 5 6 |
|
24. Update Objects
Update fields on a subset of the documents in a collection
Syntax : RMPCollection.updateMany(collectionName, data, query);
Parameters :
Name | Type | Description |
---|---|---|
collectionName | String | Name of the collection |
data | Map | Data to be updated in a collection |
query | Map | Query to filter objects to be retrieved |
Returns : Number of updated fields
Type : Integer
Example :
1 2 3 4 5 6 |
|
RMPData
Methods for Data
25. Get Current User
Get the current application user information
Syntax : RMPData.getCurrentUser();
Parameters : None
Returns : Details of the current Application User
Type : Map
Example :
1 2 3 |
|
26. Get Execution Mode
Get the execution mode of the application
Syntax : RMPData.getExecutionMode();
Parameters : None
Returns : Application Execution Mode
Type : String
Example :
1 2 3 |
|
27. Get All Context Variables
Get all variables from the context of a process request.
Syntax : RMPData.getAllContextVariables()
Parameters : None
Returns : Details of the current Application User
Type : Map
Example :
1 2 3 4 5 |
|
28. Get App Instance ID
Get the Wi instance ID mapped with the current process. This function works only when we link the web interface to get the App instance ID.
Syntax : RMPData.getAppInstanceId();
Parameters : None
Returns : The identifier of the app instance is mapped with the current request.
Type : String
Example :
1 2 3 |
|
29. Get Context Variable
Get variables with a key from the context of a process request.
Syntax : RMPData.getContextVariable(key)
Parameters :
Name | Type | Description |
---|---|---|
Key | String | key of the Object |
Returns : Return the JSON object as a string representing the context variable for the given key.
Type : String
Example :
1 2 3 4 5 |
|
30. Get Project ID
Get the project Id of the current request.
Syntax : RMPData.getProjectId();
Parameters : None
Returns : Identifier of the project.
Type : Long
Example :
1 2 3 |
|
31. Log (message)
Sends a custom message to RunMyLog
Syntax : RMPData.log("msg");
Parameters :
Name | Type | Description |
---|---|---|
msg | String | Text sent to the Log |
Returns : The result of the log operation
Type : Boolean
Example :
1 2 3 |
|
32. Log with (String, String)
Log a message.
Logs in the P_message variable of the request and in the Mongo data of the customer. In TEST mode all the levels are logged but in LIVE mode, only SEVERE level is logged. This rule is skipped if the attributes P_log is present in the resource, in this case, the given P_log will be the reference.
Syntax : RMPData.log(String, String);
Parameters :
Name | Type | Description |
---|---|---|
level | String | Level of the log (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST). |
message | String | Message to be logged. The size of the message is limited to 3Kbytes: any bigger message is truncated, and terminated by "(...)" |
Returns : Logged message
Type : String
Example :
1 2 3 |
|
33. Ping
Check the server connection
Syntax : RMPData.ping();
Parameters : None
Returns : Server response
Type : String
Example :
1 2 3 |
|
34. Ping JSON
Check the server connection.
Syntax : RMPData.pingJSON(value )
Parameters :
Name | Type | Description |
---|---|---|
value | Object | object to be returned |
Returns : Object to be returned first key and value
Type : Object
Example :
1 2 3 4 |
|
35. Set Output
Returns the value of the variable passed
Syntax : RMPData.setOutput(value);
Parameters :
Name | Type | Description |
---|---|---|
value | Value Object | Enter the Variable whose value will be given as the output |
Returns : The output of the value passed
Type : Void
Example :
1 2 3 4 |
|
36. Set Context Variable
Add a variable with a key to the context of a process request.
Syntax : RMPData.setContextVariable(key, value)
Parameters :
Name | Type | Description |
---|---|---|
key | String | Key to Object |
value | Object | Object to be set to the context. |
Example :
1 2 3 |
|
RMPFile
Methods for Files
37. Append File
Append data to an existing file. Works only for uploaded files.
Syntax : RMPFile.append(fileID, content);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file to be appended. A new file is created if ‘fileID’ is empty. |
content | String | The data to be added into the file. |
Returns : Identifier of the appended file.
Type : String
Example :
1 2 3 |
|
38. Create File
Create a new file. Works only for uploaded files
Syntax : RMPFile.create(name, content);
Parameters :
Name | Type | Description |
---|---|---|
name | String | Name of the file |
content | String | The data to be added into the file. |
Returns : Identifier of the created file.
Type : String
Example :
1 2 3 4 |
|
39. Delete File
Delete an existing file. Works only for uploaded files.
Syntax : RMPFile.delete(fileID);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file to be deleted. |
Returns : The result of the delete operation (true, false)
Type : Boolean
Example :
1 2 3 4 |
|
40. File Content
Read the content of a file.
Syntax : RMPFile.getContent(fileID);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file. |
Returns : The Content of the file
Type : String
Example :
1 2 3 4 5 |
|
41. File Description
Get the metadata describing a file on the platform.
Syntax : getDescription(fileID);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file. |
Returns : The description of a file.
Type : JSON Object
Example :
1 2 3 4 5 |
|
42. File Replace
Replace the occurrences of a string in a file and save it. Works only for uploaded files.
Syntax : RMPFile.replaceInFile(fileID, oldString, replacement);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file. |
oldString | String | The data to be replaced |
replacement | String | The data to be inserted or replaced with |
Returns : File Identifier.
Type : String
Example :
1 2 3 4 |
|
43. File Size
Get the size in KBytes of a file on the platform.
Syntax : RMPFile.getSize(fileID);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file. |
Returns : Size of the File in KB (KiloBytes) along with File description.
Type : Map
Example :
1 2 3 4 5 |
|
44. Index Of
Find the index of the first occurrence of a string in a file.
Syntax : RMPFile.indexOf(fileId, substring);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file to be searched upon. |
substring | String | Text to be matched with the file content |
Returns : Index position of the given string.
Type : Integer
Example :
1 2 3 4 5 |
|
45. Last Index Of
Find the last occurrence of a string in a file.
Syntax : RMPFile.lastIndexOf(fileId, substring);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file to be read. |
substring | String | String to be searched in the file content. |
Returns : Index of the first occurrence or -1 if nothing is found.
Type : Integer
Example :
1 2 3 4 5 |
|
46. Read Excel Spreadsheet
Read cells from an Excel worksheet. Note: Works for XLSX format of Excel files only
Syntax : RMPFile.readExcelSpreadsheet(fileId, sheetName)
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the Excel file uploaded on the platform. |
sheetName | String | Worksheet descriptor listing the cells to be read. |
Returns : Index of the first occurrence or -1 if nothing is found.
Type : Integer
Example :
1 2 3 4 5 6 7 8 9 |
|
47. Save
Overwrite an existing file. Works only for uploaded files.
Syntax : RMPFile.save(fileId, content);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file to be overridden. |
content | String | New content of the file. |
Returns : Identifier of the file
Type : String
Example :
1 2 3 4 5 |
|
48. Save Description
Modify the metadata describing a file on the platform.
Syntax : RMPFile.saveDescription(fileId, metadata);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | ID of the file to be modified. |
metadata | filedescriptor | New metadata of the file. |
Returns : New metadata of the file.
Type : Filedescriptor
Example :
1 2 3 4 5 6 |
|
49. UNZIP
Unzip a file, and create a new file with the unzipped data. Works only for uploaded files.
Syntax : RMPFile.unzip(fileID);
Parameters :
Name | Type | Description |
---|---|---|
fileID | String | Identifier of the file to be unzipped. |
Returns : UNZIP File Identifier.
Type : List (String)
Example :
1 2 3 4 5 |
|
50. ZIP
Zip a file, and create a new file with the zipped data. Works only for uploaded files.
Syntax : RMPFile.zip(name, fileIDs);
Parameters :
Name | Type | Description |
---|---|---|
name | String | Name for the ZIP file to be created |
fileIDs | List (String) | Identifier of the files to be zipped. |
Returns : ZIP File Identifier
Type : String
Example :
1 2 3 4 5 |
|
RMPProject
Methods for Project
51. Delete Project Vault
Delete a project vault.
Syntax : RMPProject.deleteProjectVault();
Parameters : None
Returns : True if the project vault has been found and deleted, false otherwise.
Type : Boolean
Example :
1 2 3 4 |
|
52. Get Access URL
Update the metadata of a project.
Syntax : RMPProject.getAccessUrl(includeProtocol);
Parameters :
Name | Type | Description |
---|---|---|
includeProtocol | Boolean | Whether or not including the protocol in the URL. |
Returns : URL with or without protocol.
Type : String
Example :
1 2 3 4 |
|
53. Get Custom List
Get the content of a custom list.
Syntax : RMPProject.getCustomList(listId);
Parameters :
Name | Type | Description |
---|---|---|
listId | String | Identifier of a custom list. |
Returns : List of JSONArray format
Type : Array
Example :
1 2 3 4 |
|
54. Get OAuth2 Token
Retrieve an OAuth2 service token.
Syntax : RMPProject.getOAuth2Token(service);
Parameters :
Name | Type | Description |
---|---|---|
service | string | Name of the OAuth2 service which token is to be retrieved. |
Returns : The OAuth2 token is associated with the specified service. If found this token will contain at least an access_token
field. This can be used for example in the token field of an OAuth2 connector configuration: RMPProject.getOAuth2Token("my_service").access_token
. An OAuth2 service token value depends on the current request execution mode.
Type : Object
Example :
1 2 3 4 |
|
55. Get Project Metadata
Get the metadata of a project.
Syntax : RMPProject.getProjectMetadata(projectId);
Parameters :
Name | Type | Description |
---|---|---|
projectId | Integer | Identifier of the project. |
Throws : Project not found
Returns : Project metadata.
Type : Object
Example :
1 2 3 4 |
|
56. Get Project Vault
Retrieve the project vault associated with the project containing the current request.
Syntax : RMPProject.getProjectVault();
Parameters : None
Returns : The current request project vault. A project vault value depends on the current request execution mode.
Type : Object
Example :
1 2 3 4 |
|
57. Save Custom List
Update a custom list with new content.
Syntax : RMPRequest.saveCustomList(listID, Map data);
Parameters :
Name | Type | Description |
---|---|---|
listID | String | Identifier of a custom list |
listId | Array | New content of the custom list |
Throws : Custom list not found
Returns : New content.
Type : Array
Example :
1 2 3 4 5 |
|
58. Save Project Metadata
Update the metadata of a project.
Syntax : RMPProject.saveProjectMetadata(name,metaData);
Parameters :
Name | Type | Description |
---|---|---|
name | String | Identifier of the project. |
metaData | Object | Project metadata |
Returns : Project name.
Type : String
Example :
1 2 3 4 |
|
59. Save Project Vault
Modify or create a project vault.
Syntax : RMPProject.saveProjectVault(data);
Parameters :
Name | Type | Description |
---|---|---|
vault | Object | An object representing the vault associated with the project containing the current request. This object may contain any fields. |
Returns : The updated project vault.
Type : Object
Example :
1 2 3 4 5 |
|
RMPRequest
Methods for Requests
60. 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
Example :
1 2 3 4 |
|
61. 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, 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 | boolean | Optional | web | If context=mobile, the generated URL will be adapted to the RunMyApp environment |
Returns : Task URL
Type : String
Example 1 :
1 2 3 4 |
|
Example 2 :
1 2 3 4 |
|
62. Get Request Info
Describe a process request.
Syntax : RMPRequest.getRequestInfo(requestId);
Parameters :
Name | Type | Argument | Description |
---|---|---|---|
requestId | String | Optional | Identifier of the process request to describe. By default the descriptor of the current process request is provided. |
Throws : Request not found.
Returns : Process request descriptor.
Type : Object
Example :
1 2 3 4 |
|
63. 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
Example :
1 2 3 4 |
|
64. 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
Example :
1 2 3 4 |
|
65. 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, timeoutInMs)
Parameters :
Name | Type | Argument | Description |
---|---|---|---|
lockName | String | - | Name of the lock |
timeoutInMs | Long | Optional | Maximum time to wait to get the lock (in milliseconds). If this number is greater than 40 seconds, the method will wait only 40 seconds |
expirationInSecs | Long | Optional | 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
Example :
1 2 3 4 5 6 7 8 9 10 |
|
66. 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.
Example :
1 2 3 4 |
|
67. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}.
Type : JSON object
Example :
1 2 3 4 |
|
68. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}.
Type : JSON object
Example :
1 2 3 4 |
|
69. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}.
Type : JSON object
Example :
1 2 3 4 |
|
70. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}.
Type : JSON object
Example :
1 2 3 4 |
|
71. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}.
Example :
1 2 3 4 |
|
72. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}
Example :
1 2 3 4 |
|
73. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}
Type : JSON object
Example :
1 2 3 4 |
|
74. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}.
Type : JSON object
Example :
1 2 3 4 |
|
75. 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
Example :
1 2 3 4 |
|
76. 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
Example :
1 2 3 4 |
|
77. Unlock
Release a lock.
Release a lock acquired with RMPRequest.unlock().
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
Example :
1 2 3 4 5 6 7 8 9 10 |
|
78. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}.
Type : JSON object
Example :
1 2 3 |
|
79. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}
Type : JSON object
Example :
1 2 3 4 |
|
80. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}
Type : JSON object
Example :
1 2 3 4 |
|
81. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}
Type : JSON object
Example :
1 2 3 4 |
|
82. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}
Example :
1 2 3 4 |
|
83. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}
Example :
1 2 3 4 |
|
84. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}
Type : JSON object
Example :
1 2 3 4 |
|
85. 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: ie: {:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}
Type : JSON object
Example :
1 2 3 4 |
|
RMPUser
Methods for User
86. Get Application
Get the list of applications authorized to a user. This method can be used in a web interface.
Syntax : RMPUser.getApplications(login, appContext, theMode, isTagged);
Parameters :
Name | Type | Argument | Default | Description |
---|---|---|---|---|
login | String | Optional | current user's login | User login/email. Current user by default |
appContext | String | Optional | web | Context in which the application can be used: web, mobile or tablet. |
theMode | String | Optional | 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. By default, this is the current execution mode. |
isTagged | Boolean | Optional | false | return the JSONObject representing the list of user interfaces group by tag if true |
Returns : List of applications
Type : Array
Example :
1 2 3 4 |
|
87. 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 | Argument | Description |
---|---|---|---|
login | String | Optional | User login/email. Current user by default |
Returns : Lane descriptor
Type : Object
Example :
1 2 3 4 |
|
88. Get Lane Users
Get the list of users pertaining to a lane.
Get the list of users pertaining to a lane (result is 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.
Syntax : RMPUser.getLaneUsers(poolId, laneId, pageSize, first);
Parameters :
Name | Type | Description |
---|---|---|
poolId | Integer | Pool identifier |
laneId | Integer | Lane identifier |
pageSize | Integer | Number of users returned |
first | Integer | Index for pagination |
Returns : List of user's descriptors
Type : Array
Example :
1 2 3 4 |
|
89. 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, level);
Parameters :
Name | Type | Argument | Default | Description |
---|---|---|---|---|
login | String | User login / email. | ||
level | Integer | Optional | 1 | Number of levels of hierarchy |
Throws : No manager found
Returns : Login/Email of a manager
Type : String
Example :
1 2 3 4 |
|
90. 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
Example :
1 2 3 |
|
91. 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
Example :
1 2 3 |
|
92. Get User Metadata
Get the metadata of the active user.
Syntax : RMPUser.getUserMetaData();
Parameters : None
Returns : User Metadata
Type : Map
Example :
1 2 3 |
|
93. Get User Metadata with (login)
Get the metadata of the user.
Syntax : RMPUser.getUserMetaData(login);
Parameters :
Name | Type | Description |
---|---|---|
login | String | The mail ID of the recipient |
Returns : User Metadata
Type : Map
Example :
1 2 3 |
|
94. Get User Preferences
Get the preferences associated with a user.
Syntax : RMPUser.getUserPreferences(login);
Parameters :
Name | Type | Argument | Description |
---|---|---|---|
login | String | Optional | Login of the user for which the preferences shall be retrieved. By default, preferences are retrieved for the current user. |
Returns : User's preferences
Type : Object
Example :
1 2 3 4 |
|
95. 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(login, laneId);
Parameters :
Name | Type | Argument | Description |
---|---|---|---|
login | String | Optional | User login / email. Current user by default. |
laneId | Integer | Lane 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
Example :
1 2 3 4 |
|
96. 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
Example :
1 2 3 4 5 |
|
97. Save User Metadata
Modify the metadata of a user.
Syntax : RMPUser.saveUserMetaData(login, metadataJSON);
Parameters :
Name | Type | Argument | Description |
---|---|---|---|
login | String | Optional | User login/email. Current user by default |
metadataJSON | Integer | New metadata |
Returns : Login of the user
Type : String
Example :
1 2 3 4 5 |
|
98. Save User Preferences
Save the preferences associated with a user.
Syntax : RMPUser.saveUserPreferences(userPreferences)
Parameters :
Name | Type | Description |
---|---|---|
userPreferences | object | User's preferences |
Returns : User login ID.
Type : String
Example :
1 2 3 4 |
|
RMPUtilities
Methods for Utilities
99. CSV To JSON
Converts an CSV input into JSON format.
Syntax : RMPUtilities.csvToJson(object, optionList);
Parameters :
Name | Type | Description |
---|---|---|
object | String | Input file |
optionList | Map | Options to be used for defining the JSON parsing behavior |
Returns : JSON file.
Type : String
Example :
1 2 3 4 |
|
100. Decrypt
Returns the decrypted version of the string provided in input. - This method can be used in a web interface.
Syntax : RMPUtilities.decrypt(input, vector, keystring);
Parameters :
Name | Type | Description |
---|---|---|
input | String | Encrypted text |
vector | String | The initialization vector |
keystring | String | Key to decrypt the ciphered text |
Returns : Decrypted String.
Type : String
Example :
1 2 3 4 |
|
101. Encrypt
Returns the encrypted version of the string provided in input. - This method can be used in a web interface.
Syntax : RMPUtilities.encrypt(input, key);
Parameters :
Name | Type | Description |
---|---|---|
input | String | Input text to encrypt |
key | String | A variable value to encrypt the text |
Returns : A result containing the initialization vector (iv
field) and the encrypted version of input (encrypted
field).
Type : Map
Example :
1 2 3 4 |
|
102. JSON To CSV
Convert the JSON input array to CSV format
Converts an array of either JSON objects or arrays to a CSV string. The contained JSON objects must only consist of simple types - no nested objects are allowed. Arrays also must only consist of simple types. The line end is CRLF.
Syntax : RMPUtilities.jsonToCsv(input, options);
Parameters :
Name | Type | Argument | Description |
---|---|---|---|
input | Object | User login/email. Current user by default | |
options | Object | Optional | Options to be used for defining the JSON parsing behavior |
Returns : The resulting CSV data as a string
Type : String
Example :
1 2 3 4 |
|
103. RSA Hash
Generating RSA digital signature specifying the algorithm & encoding.
Syntax : RMPUtilities.rsaHash(input, options);
Parameters :
Name | Type | Argument | Default | Description |
---|---|---|---|---|
data | String | Data to be signed | ||
key | String | The private key readers supports PEM files with PKCS#8 or PKCS#1 encodings. It doesn't support encrypted PEM files | ||
algorithm | String | Optional | SHA256 | SHA256 (default), SHA1 or MD5 |
encoding | String | Optional | BASE64 | New BASE64 (default), BASE64URL or HEXA |
Returns : Data signed
Type : String
Example :
1 2 3 4 5 6 7 |
|
104. UUID
Generate a universally unique identifier or UUID
Syntax : RMPUtilities.uuid();
Parameters : None
Returns : UUID value
Type : String
Example :
1 2 3 4 |
|
Please give details of the problem