Skip to content

Server-Side Javascript ES6 API Reference

Introducing a new Javascript ES6-based backend engine designed to elevate the functionality and capabilities of our application. In terms of custom RMP function this engine is feature-equivalent to the older Freemarker engine. However, developers can use the more powerful Javascript language compared to the more limited scope of Freemarker.

This section will walk you through the essential steps and concepts, and help you streamline your workflow, whether you're looking to automate tasks, extend functionality, or solve complex problems.

Please note that RMP always offered Javascript as a backend language (without custom RMP functions) based on Mozilla Rhino. However, this older JS engine is now considered deprecated.

Limitations

  • Scripts executed JS ES6 are executed in a resource-isolated environment which is more strict in terms of time and memory limits
  • The JS ES6 engine does not permit I/O operations.
  • You cannot add external libraries to the execution environment.
  • While there are slight differences between the older engine ("Mozilla Rhino") and ES6, you should be able to migrate scripts with little effort. The most significant difference is the way data is return back into the process engine - see RMPData.setOutput(...) below.
  • There may be an initial deplay of ca. 5 seconds when executing a script. This should be rare and is related to auto-scaling.
  • Multi-account users (e.g. third-party support users) are not supported
  • The JS ES6 engine supports the pure JS ES6 language scope.

Basic Script Setup

The new engine can be triggered when specifying a script like this (e.g. as input/output parameters of a process):

<@script env="js">
... javascript code here ...
</@script>

Besides the standard Javascript language, there are a number of RMP Objects which provide access to custom functions. e.g. for creating a custom MongoDB collection, you'd choose the RMPCollection class with the corresponding function name like:

<@script env="js">
 var someResponse = RMPCollection.createCollection("some collection name", false, false);
</@script>

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
  • Map (JSON Object)
  • Array (JSON Array)

Option 1:

You can specify the response explicitly via the custom function below. All output objects will be transformed into text format.

<@script env="js">
 RMPData.setOutput(someResponseObject);
</@script>

Option 2:

In Javascript you can implement a function that returns the value.


<@script env="js">
    (function(t) {  return someResponseObject; })
</@script>

Error Handling

The functions will produce an exception with a reasonable error message, and the execution fails.

Saving Data into the Process Context

<@script env="js">
      ...
      RMPData.setContextVariable(someKey, someValue);
      ...
</@script>

JS ES6 vs Freemarker

Freemarker:


<#assign result = append_file("73f01850-1a85-11ec-8413-8c859067f180","coucou")>
${result}

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:


<#assign result>
  append_file("73f01850-1a85-11ec-8413-8c859067f180","coucou")
</#assign>
${result}

JS ES6 (see also Response Handling):

<@script env="js">
var result = RMPFile.append("73f01850-1a85-11ec-8413-8c859067f180","coucou");
RMPData.setOutput(result);
</@script>

var x = y; is a standard JS value assignment.

User RMPData.setOutput(x); for returning the variable value to the workflow / app.

Javascript Reference Guide (External - by Mozilla Foundation)

  • Javascript Reference
  • RunMyProcess-specific Custom Functions for Workflows

    Please refer to the following pages for the function documentation:

    RMPApplication : object

    Kind: global namespace

    RMPApplication.attachFile

    Attach files to Application

    Kind: static method of RMPApplication
    Returns: Array.<Object> - Descriptors of the attached files.

    Param Type Description
    fileIds Array.<string> The variable of an uploaded file widget, containing one file identifier or a list of file identifiers
    widgetId string 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.

    Example

    var fileIds = ["fd58e98b-447e-42f8-8a78-24b55d928f3e"];
    var res =  RMPApplication.attachFile(fileIds,"uploadFile_1");
    RMPData.setOutput(res);
    

    RMPApplication.detachFile

    Detach a file or a list of files from an application.

    Kind: static method of RMPApplication
    Returns: Array.<Object> - Descriptors of the detached files.

    Param Type Description
    fileIds Array.<string> 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.

    Example

    var fileIds = ["fd58e98b-447e-42f8-8a78-24b55d928f3e"];
    var instId = RMPData.getAppInstanceId();
    var res =  RMPApplication.detachFile(fileIds,instId);
    RMPData.setOutput(res);
    

    RMPApplication.listAttachedFiles

    List the files attached to an application.

    Kind: static method of RMPApplication
    Returns: Array.<Object> - Array of the attached files.

    Param Type Description
    instanceId string Application instance.

    Example

    var instanceId = "4ab793b0-6157-49b7-b95f-3112360a8f9a";
    var res =  RMPApplication.listAttachedFiles( instanceId );
    RMPData.setOutput(res);
    

    RMPApplication.getHistory

    Get the history of modifications of application instances during a process, just as the history widget would do it.

    Kind: static method of RMPApplication
    Returns: Array.<Object> - Array of history metadata.

    Example

    var history = RMPApplication.getHistory();
    RMPData.setOutput(history);
    

    RMPApplication.getInstanceInfo

    Get the metadata describing an application instance.

    Kind: static method of RMPApplication
    Returns: Object - Application metadata

    Param Type Description
    fileIds string The variable of an uploaded file widget, containing one file identifier or a list of file identifiers

    Example

    var info = RMPApplication.getInstanceInfo("2518ba82-b617-4e5b-8673-6ba414b19203");
    RMPData.setOutput(info);
    

    RMPApplication.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.

    Kind: static method of RMPApplication
    Returns: string - Target translation or defaultValue if nothing is found.

    Param Type Description
    key string input text
    defaultValue string (optional) Default value if key is not found in language.
    language string (optional) Language code (two letters)

    Example

    var res =  RMPApplication.getI18n("Text","defaultVal");
    RMPData.setOutput(res);
    

    Objects

    RMPCollection: object

    Typedefs

    ImportOptions: object

    Kind: global namespace

    RMPCollection.createCollection

    Creates a new Mongo collection.

    Kind: static method of RMPCollection
    Returns: boolean - Collection successfully created or not.

    Param Type Description
    collectionName string Name of the Mongo collection.
    isPublic boolean Whether Mongo collection can be accessed publicly, without checking rights.
    isReadOnly boolean Whether the Mongo collection can only be modified by an administrator of the customer account.

    Examples

    // Example 1: Create a private collection with read-write access for administrators only
    var result1 = RMPCollection.createCollection('private_collection', false, true);
    RMPData.setOutput(result1);
    // Example 2: Create a public collection with read and write access
    var result2 = RMPCollection.createCollection('public_collection', true, false);
    RMPData.setOutput(result2)
    

    RMPCollection.drop

    Drops a Mongo collection

    Kind: static method of RMPCollection
    Returns: boolean - Collection successfully removed or not.

    Param Type Description
    collectionName string Name of the Mongo collection.

    Example

    var isDropped = RMPCollection.drop('col_rms_v1_new');
    RMPData.setOutput(isDropped);
    

    RMPCollection.renameCollection

    Renames a Mongo collection

    Kind: static method of RMPCollection
    Returns: boolean - Renaming successful or not.

    Param Type Description
    oldCollectionName string Current name of the Mongo collection.
    newCollectionName string New name of the Mongo collection.

    Example

    var isSuccess = RMPCollection.renameCollection('col_rms_v1', 'col_rms_v1_new');
    RMPData.setOutput(isSuccess);
    

    RMPCollection.createIndex

    Creates indexes on Mongo collection

    Kind: static method of RMPCollection
    Returns: boolean - Creation of the index was successful or not.

    Param Type Description
    collectionName string Name of the Mongo collection.
    indexName string Name of the Index.
    indexArray Array.<string> Index Array.
    [unique] boolean Whether the index shall observe uniqueness.
    [ascending] boolean The ordering.

    Examples

    var idx = ["attr1","attr2"]
    var isSuccess = RMPCollection.createIndex('rms_car', 'rms_car_idx', idx);
    RMPData.setOutput(is_success);
    var isSuccess = RMPCollection.createIndex('rms_car', 'rms_car_idx', idx, true);
    RMPData.setOutput(is_success);
    var isSuccess = RMPCollection.createIndex('rms_car', 'rms_car_idx', idx, false, false);
    RMPData.setOutput(is_success);
    

    RMPCollection.dropIndex

    Drops an index from a Mongo collection

    Kind: static method of RMPCollection
    Returns: boolean - Creation of the index was dropped successful or not.

    Param Type Description
    collectionName string Name of the Mongo collection.
    indexName string Name of the Index.

    Example

    var isIndexDropped = RMPCollection.dropIndex('rms_car', 'rms_car_idx');
    RMPData.setOutput(isIndexDropped);
    

    RMPCollection.listIndexes

    List of all indexes on a Mongo collection

    Kind: static method of RMPCollection
    Returns: Array.<Object.<{name: string, keys: Object, unique: boolean, ascending: boolean}>> - The list of indexes of a collection

    Param Type Description
    collectionName string Name of the Mongo collection.

    Example

    var indexList = RMPCollection.listIndexes('rms_car');
    RMPData.setOutput(indexList);
    

    RMPCollection.aggregate

    Runs an aggregation query over a Mongo collection.

    Notes:

    • You can't directly return a result set into a workflow variable as long as the $oid field is present.
    • Please make sure that you don't exceed the maximum memory limit when using the function.
    • Some functions are not available for security and management reasons including $db, $out, $facet, $merge.

    Kind: static method of RMPCollection
    Returns: Array.<Object> - JSON result of the aggregate operation.

    See: Details about the aggregation definition

    Param Type Description
    collectionName string Name of the Mongo collection.
    pipeline Array.<Object> The aggregation pipeline in MongoDB BSON format.

    Example

    var aggr = [
      { $match: { brand_id: 'bogdan_group' } },
      { $project: { nameStr: { $toString: '$name' } } },
      { $group: { _id: '$nameStr', totaldocs: { $sum: 1 } } }
    ];
    var result = RMPCollection.aggregate('Cars_info', aggr );
    for (var i = 0; i < result.length; i++) {
      if (result[i]._id && result[i]._id.$oid) {
        result[i].name = result[i]._id.$oid;
      } else {
        result[i].name = result[i]._id;
      }
      delete result[i]._id;
    }
    RMPData.setOutput(result)
    

    RMPCollection.find

    Retrieve objects from a Mongo collection.

    Notes:

    • You can't directly return a result set into a workflow variable as long as the $oid field is present
    • Please make sure that you don't exceed the maximum memory limit when using the function.

    Kind: static method of RMPCollection
    Returns: Array.<Object> - List of objects.

    See: Details on how to define a MongoDB query

    Param Type Description
    collectionName string Name of the Mongo collection.
    query object The actual query. "$query": query in MongoDB BSON object format. "$orderby": order by attributes in JSON array format.
    offset number Number of leading items to be skipped.
    limit number Max number of items returned (default: 100).
    projectionKeys array Attributes included in the query.
    first object Attribute to sort, ASC or DESC.
    removeId boolean Remove Id attribute in the query.

    Examples

    1.RMPCollection.find(collectionName, query)

    var f = RMPCollection.find('collect1', {});
      for (var i = 0; i < f.length; i++) {
      var doc = f[i];
      if (doc._id && doc._id.$oid) {
        doc.id_str = doc._id.$oid;
        delete doc._id;
      }
    }
    RMPData.setOutput(f);
    

    2.RMPCollection.find(collectionName, query, offset)

    var f = RMPCollection.find('collect1', {},1);
    for (var i = 0; i < f.length; i++) {
      var doc = f[i];
      if (doc._id && doc._id.$oid) {
        doc.id_str = doc._id.$oid;
        delete doc._id;
      }
    }
    RMPData.setOutput(f);
    

    3.RMPCollection.find(collectionName, query, offset, limit)

    var f = RMPCollection.find('collect1', {},1,1);
    for (var i = 0; i < f.length; i++) {
      var doc = f[i];
      if (doc._id && doc._id.$oid) {
        doc.id_str = doc._id.$oid;
        delete doc._id;
      }
    }
    RMPData.setOutput(f);
    

    4.RMPCollection.find(collectionName, query, projectionKeys, first, limit)

    var f = RMPCollection.find('collect1', {}, ['id','age'],{'age':'DESC'}, 0 ,10);
    RMPData.setOutput(f);
    

    5.RMPCollection.find(collectionName, query, projectionKeys, orderBy, first, limit, removeId)

    var f = RMPCollection.find('collect1', {}, ['id','age'],{'age':'DESC'}, 0 ,10, true);
    RMPData.setOutput(f);
    

    RMPCollection.countDocuments

    Count documents verifying a condition in a Mongo collection

    Kind: static method of RMPCollection
    Returns: number - The number of documents matching the query
    See: Details on how to define a MongoDB query

    Param Type Description
    collectionName string Name of the Mongo collection.
    query Object The actual query in JSON format.

    Example

    var query = {};
      var counted = RMPCollection.countDocuments('car_rms', query);
      RMPData.setOutput(counted);
    

    RMPCollection.insertOne

    Insert a JSON document in a Mongo collection

    Kind: static method of RMPCollection
    Returns: Object - The document

    Param Type Description
    collectionName string Name of the Mongo collection.
    doc Object The document to be inserted in JSON format

    Example

    var document = {"engine":"e1","brand_label":"Brand-1","name":"Name-1","brand_id":"b1"};
    var storedDocument = RMPCollection.insertOne('car_rms', document);
    RMPData.setOutput(storedDocument);
    

    RMPCollection.insertMany

    Insert an array of JSON documents in a Mongo collection

    Kind: static method of RMPCollection
    Returns: Array.<Object> - The array of documents

    Param Type Description
    collectionName string Name of the Mongo collection.
    docs Array.<Object> The document to be inserted in JSON format

    Example

    var docs = [
      {
        "engine": "e2",
        "brand_label": "Brand-2",
        "name": "Name-2",
        "brand_id": "b2"
      },
      {
        "engine": "e3",
        "brand_label": "Brand-3",
        "name": "Name-3",
        "brand_id": "b3"
      }
    ];
    var storedDocuments = RMPCollection.insertMany('car_rms', docs);
    RMPData.setOutput(storedDocument);
    

    RMPCollection.deleteMany

    Deletes documents that matches with the given query

    Kind: static method of RMPCollection
    Returns: number - The number of objects deleted
    See: Details on how to define a MongoDB query

    Param Type Description
    collectionName string Name of the Mongo collection.
    query Object The actual query in JSON format.

    Example

    var query = {'brand_id':'b3'};
    var numberDeleted = RMPCollection.deleteMany('car_rms', query);
    RMPData.setOutput(numberDeleted);
    

    RMPCollection.updateMany

    Update documents with a setter according to a given query in a Mongo collection

    Kind: static method of RMPCollection
    Returns: number - The number of documents updated
    See: Details on how to define a MongoDB updates

    Param Type Description
    collectionName string Name of the Mongo collection.
    upd Object The setter for the document fields to be updated in BSON format.
    query Object The actual query in BSON format.
    [multi] boolean Whether one or multiple documents shall be updated
    [updateOperator] boolean Whether to update or replace a document if multi=false

    Example

    var query = {'brand_id':'b2'};
    var upd = {'$set':{'engine':'e2','brand_label':'Brand-2','name':'Name-2'}};  
    var numberUpdated = RMPCollection.updateMany('car_rms', upd, query, true);
    RMPData.setOutput(numberUpdated);
    

    RMPCollection.updateOne

    Updates the first document with a setter according to the query in a Mongo collection

    Kind: static method of RMPCollection
    Returns: number - The number of documents updated
    See: Details on how to define a MongoDB updates

    Param Type Description
    collectionName string Name of the Mongo collection.
    upd Object The setter for the document fields to be updated in BSON format.
    query Object The actual query in BSON format.

    Example

    var query = {'brand_id':'b2'};
    var upd = {'$set':{'engine':'e2','brand_label':'Brand-2','name':'Name-2'}};  
    var numberUpdated = RMPCollection.updateOne('car_rms', upd, query);
    RMPData.setOutput(numberUpdated);
    

    See Also:

    Details on how to define a MongoDB updates

    RMPCollection.updateField

    Update fields on a subset of the documents in a Mongo collection

    Kind: static method of RMPCollection
    Returns: number - The number of updated field

    Param Type Description
    collectionName string Name of the Mongo collection.
    upd Object The value in JSON format.
    query Object The actual query in JSON format.
    [multi] boolean Whether one or multiple documents shall be updated

    Example

    var query = {'brand_id':'b2'};
    var upd = {"engine":"engine_3"};
    var f = RMPCollection.updateField('car_rms', upd, query, true);
    RMPData.setOutput(f);
    

    RMPCollection.deleteField

    Deletes one or more fields from documents that matches with the given query

    Kind: static method of RMPCollection
    Returns: number - The number of updated documents

    Param Type Description
    collectionName string Name of the Mongo collection.
    query Object The actual query in JSON format.
    fieldName String Name of the field.
    [multi] boolean Whether one or multiple documents shall be updated

    Example

    var query = {"name":"delete_me!"};
    var numberUpdated = RMPCollection.deleteField('car_rms', query, 'engine');
    RMPData.setOutput(numberUpdated)
    

    RMPCollection.importCSV

    Import objects to a collection from a CSV file

    Kind: static method of RMPCollection
    Returns: number - The number of imported objects.

    Param Type Description
    fileId string Reference of an uploaded file.
    collectionName string Name of the Mongo collection.
    options ImportOptions Options to be used.
    dropCollection boolean Whether to drop the existing content of a collection before the import

    Example

    var options = {};
    var numberImported = RMPCollection.importCSV("30ad9a42-8a4e-48b3-b857-660979eb77dd", "myCollection", options);
    RMPData.setOutput(numberImported);
    

    RMPCollection.importJSON

    Import objects to a Mongo collection from a JSON file.

    Kind: static method of RMPCollection
    Returns: number - The number of imported objects.

    Param Type Description
    fileId string Reference of an uploaded file.
    collectionName string Name of the Mongo collection.
    options ImportOptions Options to be used.
    dropCollection boolean Whether to drop the existing content of a collection before the import

    Example

    var options = {};
    var numberImported = RMPCollection.importJSON("30ad9a42-8a4e-48b3-b857-660979eb77dd", "myCollection", options);
    RMPData.setOutput(numberImported)
    

    ImportOptions

    Object

    Kind: global typedef
    Properties

    Name Type Description
    [separator] string Separator between two values (e.g. ; or ,). Default: ,
    [delimiter] string Used to allow values containing a separator character (e.g. " or '), to include a delimiter in a value, use two delimiters (e.g. ""). Default: "
    [empty] string Value to be used to represent an empty value (two separators in a row). Default: ""
    [charset] string Character set to be used to read the file content. Default: UTF-8
    [parse_numbers] Array.<string> Names/indices of columns containing numerical values to be stored as Double. e.g ["age",3] will parse columns header "age" and the 4th column
    [parse_longs] Array.<string> Names/indices of columns containing long values to be stored as Long. e.g: ["age",3] will parse column header "age" and the 4th column.
    [trim] boolean Trim values before inserting them in the collection. Trimming also occurs before decoding numerical values.

    Objects

    RMPData: object

    Typedefs

    User: object

    Kind: global namespace

    RMPData.setOutput(someResult)

    Returns the result of a script execution back to the process. The result will be stored in P_result workflow variable.

    Kind: static method of RMPData

    Param Type Description
    someResult Object The result of the script execution. Can be a map or a primitive data type

    Example

    RMPData.setOutput(someResult);
    

    RMPData.getCurrentUser

    Returns information about the user that is currently executing the script

    Kind: static method of RMPData
    Returns: User - - User information in Map format

    Example

    var userInformation = RMPProject.getCurrentUser();
    RMPData.setOutput(userInformation);
    

    RMPData.getExecutionMode

    Returns the current execution mode of the underlying workflow

    Kind: static method of RMPData
    Returns: string - - the current execution mode (TEST|ACCEPTANCE|LIVE)

    Example

    var mode =RMPData.getExecutionMode();
    RMPData.setOutput(mode);
    

    RMPData.getAllContextVariables

    Returns all variables that are stored in the context of a process request.

    Kind: static method of RMPData
    Returns: Object - - a map with key-value pairs of the variable names and their values

    Example

    var variables =RMPData.getAllContextVariables();
    RMPData.setOutput(variables);
    

    RMPData.getContextVariable

    Returns a variables with a key from the context of a process request.

    Kind: static method of RMPData
    Returns: Object - - a map with key-value pairs of the variable names and their values

    Param Type Description
    key String the variable key

    Example

    var variable = RMPData.getContextVariable("theKey");
    RMPData.setOutput(variable);
    

    RMPData.getAppInstanceId

    Returns 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.

    Kind: static method of RMPData
    Returns: string - - The identifier of the app instance is mapped with the current request. \ * Example

    var applicationId =RMPData.getAppInstanceId();
    RMPData.setOutput(applicationId);
    

    RMPData.getProjectId

    Returns the project ID belonging to the current request.

    Kind: static method of RMPData
    Returns: number - - Identifier of the project.
    Example

    var projectId =RMPData.getProjectId();
    RMPData.setOutput(prgetProjectIdojectId);
    

    RMPData.log

    Sends a custom log message to RunMyLog (the RunMyProcess logging tool)

    Kind: static method of RMPData
    Returns: boolean - - whether the request was executed successfully

    Param Type Description
    logMessage string the log message

    Example

    RMPData.log("Some logging message for the custom log");
    

    RMPData.log

    Sends a custom message with a severity marker to RunMyLog (the RunMyProcess logging tool)

    Kind: static method of RMPData
    Returns: boolean - - whether the request was executed successfully

    Param Type Description
    level string Level of the log (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)
    logMessage string Message to be logged. The size of the message is limited to 3 KB. Bigger messages will be truncated

    Example

    RMPData.log("SEVERE", "Some logging message for the custom log");
    

    RMPData.raiseEvent

    Sends a custom event to the Event Management tool

    Kind: static method of RMPData
    Returns: boolean - - whether the request was executed successfully

    Param Type Description
    customKey string Name of the custom key (Note: Also relevant for triggers in Event Management)
    customMessage string A custom message
    isFailure boolean A marker whether the event should be treated as a failure event
    customData Object A map contain custom data

    Example

    var customData = {'someKey':'someValue'};
    RMPData.raiseEvent('NameOfTheEvent', 'SomeCustomMessage', false, customData);
    

    RMPData.setContetxtVariable(key, value)

    Add a variable with a key to the context of a process request.

    Kind: static method of RMPData

    Param Type Description
    key String Key to Object
    value Object Object to be set to the context.

    Example

    RMPData.setContextVariable("var2","20");
    

    User

    Object

    Kind: global typedef
    Properties

    Name Type Description
    name string the user's name
    status string the activation status of the user
    login string the login (email address)
    profile string the profile of the user e.g. Admin
    lang string the user's preferred language
    restrictions Array.<Object> the configured access restrictions
    profile string the profile of the user e.g. Admin
    [alias] Array.<String> a list of aliases associated with the user
    [delegators] Array.<Object> a list of delegations associated with the user
    [extended] Object Extended information if available
    [preferences] Object User preferences if available

    Objects

    RMPFile: object

    Typedefs

    SaveFileOptions : Object
    ReplaceInFileOptions : Object

    Optional parameters

    IndexOfOptions : Object

    Optional parameters

    FileMetadata : Object

    RMPFile : object

    Kind: global namespace

    RMPFile.create

    Create a new file. Works only for uploaded files

    Kind: static method of RMPFile
    Returns: string - - Identifier of the created file.

    Param Type Description
    name string Name of the file.
    content string The data to be added into the file.

    Example

    var createFile = RMPFile.create('test2.txt', 'abcdef');
    RMPData.setOutput(createFile);
    

    RMPFile.delete

    Delete an existing file. Works only for uploaded files.

    Kind: static method of RMPFile
    Returns: boolean - - The result of the delete operation (true, false).

    Param Type Description
    fileID string Identifier of the file to be deleted.

    Example

    var fileId = "54fedbb0-b9ae-11ed-b944-d68b202471ff";
    RMPFile.delete(fileId);
    

    RMPFile.getContent

    Read the content of a file.

    Kind: static method of RMPFile
    Returns: string - - The Content of the file.

    Param Type Description
    fileID string Identifier of the file.
    [encoding] string (optional) - "BASE64" or "NONE" (default)
    [charset] string (optional) - Character-set e.g "UTF-8" (default)
    [encoding] string (optional) - "BASE64" or "NONE" (default)
    [charset] string (optional) - Character-set e.g "UTF-8" (default)

    Example

    var fileId = "3146acd0-b0e8-11ed-ac99-ea641a55cdec";
    var content = RMPFile.getContent(fileId);
    RMPData.setOutput(content);
    

    RMPFile.save

    Overwrite an existing file. Works only for uploaded files.

    Kind: static method of RMPFile
    Returns: string - - Identifier of the file.

    Param Type Description
    fileID string Identifier of the file to be overridden.
    content string New content of the file.
    options SaveFileOptions Optional parameters limited to two parameters in Map format.

    Example

    var fileID = RMPFile.create('text.txt', 'abcdef');
    RMPFile.save(fileID, 'hirsch');
    RMPData.setOutput(fileID);
    

    RMPFile.append

    Append data to an existing file. Works only for uploaded files.

    Kind: static method of RMPFile
    Returns: string - - Identifier of the appended file.

    Param 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.
    [charset] string (optional) -Character-set e.g. "UTF-8".

    Example

    RMPFile.append("3146acd0-b0e8-11ed-ac99-ea641a55cdec", 'defghi');
    

    RMPFile.replaceInFile

    Replace the occurrences of a string in a file and save it. Works only for uploaded files.

    Kind: static method of RMPFile
    Returns: string - - Identifier of the appended file.

    Param Type Description
    fileID string Identifier of the file.
    oldString string The data to be added into the file.
    replacement string The data to be inserted or replaced with.
    [options] ReplaceInFileOptions (optional) -Character-set e.g. "UTF-8".

    Example

    var fileID = "3146acd0-b0e8-11ed-ac99-ea641a55cdec";
    RMPFile.replaceInFile(fileID, 'abc', 'efg');
    

    RMPFile.getSize

    Get the size in KBytes of a file on the platform.

    Kind: static method of RMPFile
    Returns: Object - - Size of the File in KB (KiloBytes) along with File description in Map format.

    Param Type Description
    fileID string Identifier of the file.

    Example

    var fileID = "3146acd0-b0e8-11ed-ac99-ea641a55cdec";
    var fileSize = RMPFile.getSize(fileID);
    RMPData.setOutput(fileSize);
    

    RMPFile.indexOf

    Find the index of the first occurrence of a string in a file.

    Kind: static method of RMPFile
    Returns: integer - - Index position of the given string.

    Param Type Description
    fileID string Identifier of the file to be searched upon.
    substring string Text to be matched with the file content.
    options IndexOfOptions Optional parameters limited to two parameters in Map format.

    Example

    var fileID = "3146acd0-b0e8-11ed-ac99-ea641a55cdec";
    var idx = RMPFile.indexOf(fileID, 'ab');
    RMPData.setOutput(idx);
    

    RMPFile.getDescription

    Get the metadata describing a file on the platform.

    Kind: static method of RMPFile
    Returns: Object - - The description of a file.

    Param Type Description
    fileID string Identifier of the file.

    Example

    var fileID = "3146acd0-b0e8-11ed-ac99-ea641a55cdec";
    var description = RMPFile.getDescription(fileID);
    RMPData.setOutput(description);
    

    RMPFile.saveDescription

    Modify the metadata describing a file on the platform.

    Kind: static method of RMPFile
    Returns: FileMetadata - - New metadata of the file.

    Param Type Description
    fileID string Identifier of the file.
    metadata FileMetadata New metadata of the file

    Example

    var fileID = RMPFile.create('text.txt', 'abcdef');
    var payload = {'desc' : 'file desc'};
    var description = RMPFile.saveDescription(fileID, payload);
    RMPData.setOutput(description);
    

    RMPFile.unzip

    Unzip a file, and create a new file with the unzipped data. Works only for uploaded files.

    Kind: static method of RMPFile
    Returns: Array.<string> - - UNZIP File Identifier.

    Param Type Description
    fileID string Identifier of the file to be unzipped.

    Example

    var fileId = "bd98d36e-fae7-40e6-98b6-9c115305110f";  
    var unzipFileId = RMPFile.unzip(fileId);  
    RMPData.setOutput(unzipFileId);   
    

    RMPFile.zip

    Zip a file, and create a new file with the zipped data. Works only for uploaded files.

    Kind: static method of RMPFile
    Returns: string - - ZIP File Identifier.

    Param Type Description
    name string Name for the ZIP file to be created
    fileIDs string Identifier of the files to be zipped.

    Example

    var fileId = "54fedbb0-b9ae-11ed-b944-d68b202471ff";
    var zipFileId = RMPFile.zip('test.zip', [fileId]);
    RMPData.setOutput(zipFileId);
    

    RMPFile.readExcelSpreadsheet

    Read cells from an Excel worksheet.

    Note: Works for XLSX format of Excel files only

    Kind: static method of RMPFile
    Returns: Array.<Array.<string>> - - Content of the spreadsheet.

    Param Type Description
    fileID string Identifier of the Excel file uploaded on the platform.
    sheetName string Worksheet descriptor listing the cells to be read.

    Example

    var sheet = RMPFile.readExcelSpreadsheet('54cfc512-2307-494c-a5f7-2e262c3e1add', 'Sheet1');
    sheet.forEach(function (item) {
      item.forEach( function (item) {
        console.log(item);
      });
    });
    RMPData.setOutput(sheet);
    

    SaveFileOptions

    Object

    Kind: global typedef
    Properties

    Name Type Description
    [encoding] string - "BASE64" or "NONE"
    [charset] string Character set to be used to read the file content. Default: UTF-8

    ReplaceInFileOptions

    Object

    Optional parameters

    Kind: global typedef
    Properties

    Name Type Description
    flag Array.<string> 'f'=first occurence only, 'r'=all
    flag Array.<string> 'f'=first occurence only, 'r'=all
    [algorithm] string file encoding - BASE64, SHA1, SHA-256, MD5, NONE
    [charset] string Character-set e.g "UTF-8".

    IndexOfOptions

    Object

    Optional parameters

    Kind: global typedef
    Properties

    Name Type Description
    from number start index
    algorithm string file encoding - BASE64, NONE
    charset string Character-set e.g "UTF-8".

    FileMetadata

    Object

    Kind: global typedef
    Properties

    Name Type Description
    name string file name
    type string file type.
    [visibility] string PRIVATE, PUBLIC.

    RMPProject : object

    Kind: global namespace

    RMPProject.getCustomList

    Returns the content of an existing custom list

    Kind: static method of RMPProject
    Returns: Array.<Object> - - An array of custom list elements
    Throws:

    • Error - Throws an error if the listIds empty or invalid.
    Param Type Description
    listId string Identifier of a custom list.

    Example

    var customList = RMPProject.getCustomList("b1eeebf5-d26a-4374-bf4c-03d340f17596");
    RMPData.setOutput(customList);
    

    RMPProject.saveCustomList

    Saves entries into an existing custom list

    Kind: static method of RMPProject
    Returns: Array.<Object> - - An array of custom list elements
    Throws:

    • Error - Throws an error if the custom list doesn't exist, or the payload can't be parsed.
    Param Type Description
    listId string Identifier of a custom list.
    arrayOfObjects Array.<Object> An array of custom list elements

    Example

    var payload = [{"label":"ab","value":"c"},{"label":"cd","value":"d"}]
    var customList = RMPProject.saveCustomList("b1eeebf5-d26a-4374-bf4c-03d340f17596", payload);
    RMPData.setOutput(customList);
    

    RMPProject.getProjectVault

    Retrieve the project vault associated with the project containing the current request. The vault can be used e.g. to store secrets.

    Kind: static method of RMPProject
    Returns: Object - - project vault data in Map format. A project vault value depends on the current request execution mode.
    Example

    var projectVaultData = RMPProject.getProjectVault();
    RMPData.setOutput(projectVaultData);
    

    RMPProject.saveProjectVault

    Save data into the project vault. The vault can be used e.g. to store secrets.

    Kind: static method of RMPProject
    Returns: Object - - The updated project vault. A project vault value depends on the current request execution mode.

    Param Type Description
    vault map Configurable object representing the vault associated with the current project.

    Example

    var payload = {"project":"TEST","value":"Value test"};
    var projectVaultData = RMPProject.saveProjectVault(payload);
    RMPData.setOutput(projectVaultData);
    

    RMPProject.deleteProjectVault

    Delete a project vault.

    Kind: static method of RMPProject
    Returns: boolean - - True if the project vault has been found and deleted, false otherwise.

    Example

    var f = RMPProject.deleteProjectVault();
    RMPData.setOutput(f);
    

    RMPProject.getAccessUrl

    Returns the Live URL of the current RunMyProcess instance

    Kind: static method of RMPProject
    Returns: String - - The regional URL to your current RMP instance. e.g. https://live.runmyprocess.com/

    Param Type Description
    includeProtocol boolean Whether to include the protocol in the URL

    Example

    var liveURL = RMPProject.getAccessUrl(true);
    RMPData.setOutput(liveURL);
    

    RMPProject.getProjectMetadata

    Returns the metadata of a project.

    Kind: static method of RMPProject
    Returns: Object - - The project's metadata in map format

    Param Type Description
    [projectId] number Identifier of the project. Default: current project

    Example

    var projectMetadata = RMPProject.getProjectMetadata(23324452);
    RMPData.setOutput(projectMetadata);
    

    RMPProject.saveProjectMetadata

    Saves the metadata of a project.

    Kind: static method of RMPProject
    Returns: Object - - metadata in map format

    Param Type Description
    [projectId] number Identifier of the project. Default: current project
    key String Identifier of the metadata entry
    metaData Object Identifier of the metadata entry.

    Example

    var projectMetadata = RMPProject.saveProjectMetadata("testProjectMeta",{"name":"test3"});
    RMPData.setOutput(projectMetadata);
    

    RMPProject.getOAuth2Token

    Returns a stored OAuth2 service token.

    Kind: static method of RMPProject
    Returns: Object - - The stored OAuth2 token in Map format

    Param Type Description
    key String Name/key of the OAuth2 service which token is to be retrieved.

    Example

    var oauthToken = RMPProject.getOAuth2Token("docuSignOauth");
    RMPData.setOutput(oauthToken);
    

    RMPProject.saveOAuth2Token

    Save an OAuth2 service token.

    Kind: static method of RMPProject
    Returns: Object - - The stored OAuth2 token in Map format

    Param Type Description
    key String Name/key of the OAuth2 service which token is to be retrieved.
    token Object Name/key of the OAuth2 service which token is to be retrieved.

    Example

    var oauthToken = RMPProject.saveOAuth2Token("docuSignOauth");
    RMPData.setOutput(oauthToken);
    

    RMPRequest : object

    Kind: global namespace

    RMPRequest.addUserToLane

    Add a user to the given runtime lane.

    Kind: static method of RMPRequest
    Returns: boolean - - Status if adding a user to the lane.

    Param Type Description
    laneId number Identifier of the lane.
    userId number Id or login of the user.

    Example

    var addUserToLaneRequest = RMPRequest.addUserToLane(53877772,65914367);
    RMPData.setOutput(addUsertolaneRequest);
    

    RMPRequest.getNextUrl

    Add a user to the given runtime lane.

    Kind: static method of RMPRequest
    Returns: string - - get the Task URL.

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

    Example

    var nextURL = RMPRequest.getNextUrl(2,false,"mobile");
    RMPData.setOutput(nextURL);
    var nextURL2 = RMPRequest.getNextUrl(2, false);
    RMPData.setOutput(nextURL2);
    

    RMPRequest.getRequestInfo

    Describe a process request.

    Kind: static method of RMPRequest
    Returns: Object - - Process request descriptor.

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

    Example

    var requestData = RMPRequest.getRequestInfo("fcb7a691-38bd-4b26-b1a7-82cca9d6ecf0");
    RMPData.setOutput(requestData);
    

    RMPRequest.getTaskUrl

    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.

    Kind: static method of RMPRequest
    Returns: string - - get the Task URL.

    Param Type Description
    isPublic boolean Use a public task template or not.

    Example

    var taskUrl = RMPRequest.getTaskUrl(true);
    RMPData.setOutput(taskUrl);
    

    RMPRequest.injectParams

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

    Kind: static method of RMPRequest
    Returns: string - -Result of the last executed task.
    Example

    var injectParams = RMPRequest.injectParams();
    RMPData.setOutput(injectParams);
    

    RMPRequest.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

    Kind: static method of RMPRequest
    Returns: boolean - - Status of the lock, lock acquired or not.
    Throws:

    • Error - Timeout exception if the request doesn't get the lock.
    Param Type Description
    lockName string Name of the lock.
    timeoutInMs number (optional) Maximum time to wait to get the lock in milliseconds up to maximum of 40000ms.
    expirationInSecs number (optional) Maximum time the lock could be kept if not released programmatically (in seconds). Default: 1 hour.

    Example

    var state = "ok";
    var lockTest = RMPRequest.lock("test", 10000);
    if (lockTest) {
        RMPRequest.unlock("test");
    } else {
        state= "nok";
    }
    RMPData.setOutput(state);
    

    RMPRequest.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

    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

    Kind: static method of RMPRequest
    Returns: void - - Returns nothing.

    Param Type Description
    lockName string Name of the lock.

    Example

    var state = "ok";
    var f = RMPRequest.lock("test", 10000);
    if (f) {
      RMPRequest.unlock("test");
    } else {
      state= "nok";
    }
    RMPData.setOutput(state); 
    

    RMPRequest.raiseError

    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.

    Kind: static method of RMPRequest
    Returns: string - - Returns error message.
    Throws:

    • Error -An error(ScriptExecutionException) with the given error messageTask URL.
    Param Type Description
    errorMessage string Error message.

    Example

    var error = RMPRequest.raiseError("An error has occurred");
    RMPData.setOutput(error);
    

    RMPRequest.readFileAddLane

    Add lanes allowed to READ the file(s).

    Kind: static method of RMPRequest
    Returns: Object - - The list of lanes and users with the appropriate right for each file in JSON.

    Param Type Description
    fileIds Array.<string> a list of file identifiers.
    [laneIds] Array.<number> a list of file identifiers. Defaults to current lane.

    Example

    var j = RMPRequest.readFileAddLane(["fb090250-b571-4aba-a25a-77a996fe72ee"],[53762810]);
    RMPData.setOutput(j);
    

    RMPRequest.readFileAddUser

    Add users allowed to READ the file(s).

    Kind: static method of RMPRequest
    Returns: Object - - The list of lanes and users with the appropriate right for each file in JSON

    Param Type Description
    fileIds Array.<string> a list of file identifiers.
    [userIds] Array.<string> a list of either user identifiers. Defaults to current user

    Example

    var addUser = RMPRequest.readFileAddUser(["fb090250-b571-4aba-a25a-77a996fe72ee"],[66021605]);
    RMPData.setOutput(addUser);
    

    RMPRequest.readFileRemoveLane

    Remove lanes allowed to READ the file(s).

    Kind: static method of RMPRequest
    Returns: Object - - The list of lanes and users with the appropriate right for each file in JSON.

    Param Type Description
    fileIds Array.<string> a list of file identifiers.
    [laneIds] Array.<string> a list of lane identifiers. Defauls to current lane

    Example

    var removeLane = RMPRequest.readFileRemoveLane(["03acf9f2-609f-4cb4-bcbe-17e4005e1fea"],[53818190]);
    RMPData.setOutput(removeLane);
    

    RMPRequest.readFileRemoveUser

    Remove users allowed to READ the file(s).

    Kind: static method of RMPRequest
    Returns: Object - - The list of lanes and users with the appropriate right for each file in JSON.

    Param Type Description
    fileIds Array.<string> a list of file identifiers.
    [userIds] Array.<string> a list of either user identifiers . Defaults to current user

    Example

    var removeUser = RMPRequest.readFileRemoveUser(["fb090250-b571-4aba-a25a-77a996fe72ee"],[66021605]);
    RMPData.setOutput(removeUser);
    

    RMPRequest.removeUserFromLane

    Remove a user from the given runtime lane.

    Kind: static method of RMPRequest
    Returns: boolean - - status if adding a user to the lane.

    Param Type Description
    laneId number Identifier of the lane.
    userId number Id of the user.

    Example

    var fromLane = RMPRequest.removeUserFromLane(53877772,65914367);
    RMPData.setOutput(fromLane);
    

    RMPRequest.updateFileAddLane

    Update lane(s) allowed to WRITE/DELETE the file(s).

    Kind: static method of RMPRequest
    Returns: Object - - The list of lanes and users with the appropriate right for each file in JSON.

    Param Type Description
    fileIds Array.<string> a list of file identifiers.
    [laneIds] Array.<number> a list of lane identifiers. Defaults to current lane

    Example

    var addLane = RMPRequest.updateFileAddLane(["fb090250-b571-4aba-a25a-77a996fe72ee"],[53762810]);
    RMPData.setOutput(addLane);
    

    RMPRequest.updateFileAddUser

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

    Kind: static method of RMPRequest
    Returns: Object - - The list of lanes and users with the appropriate right for each file in JSON.

    Param Type Description
    fileIds Array.<string> a list of file identifiers.
    [userIds] Array.<number> a list of either user identifiers or user logins. Defaults to current user

    Example

    var addUser = RMPRequest.updateFileAddUser(["fb090250-b571-4aba-a25a-77a996fe72ee"],[66021605]);
    RMPData.setOutput(addUser);
    

    RMPRequest.updateFileRemoveLane

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

    Kind: static method of RMPRequest
    Returns: Object - - The list of lanes and users with the appropriate right for each file in JSON.

    Param Type Description
    fileIds Array.<string> a list of file identifiers.
    [laneIds] Array.<int> a list of lane identifiers. Defaults to current lane

    Example

    var removeLane = RMPRequest.updateFileRemoveLane(["03acf9f2-609f-4cb4-bcbe-17e4005e1fea"],[53818190]);
    RMPData.setOutput(removeLane);
    

    RMPRequest.updateFileRemoveUser

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

    Kind: static method of RMPRequest
    Returns: Object - - The list of lanes and users with the appropriate right for each file in JSON.

    Param Type Description
    fileIds Array.<string> a list of file identifiers.
    userIds Array.<string> a list of either user identifiers or user logins. Defaults to current user

    Example

    var removeUser = RMPRequest.updateFileRemoveUser(["fb090250-b571-4aba-a25a-77a996fe72ee"],[66021605]);
    RMPData.setOutput(removeUser);
    

    RMPRequest.setRequestStatus

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

    Kind: static method of RMPRequest
    Returns: boolean - - True if status updates else false.

    Param Type Description
    statusCode integer 102/201/301/302/400/401.

    Example

    var requestStatus = RMPRequest.setRequestStatus(200);
    RMPData.setOutput(requestStatus);
    

    Objects

    RMPUser: object

    Typedefs

    Application : Object
    Lane : Object
    UserData : Object

    RMPUser : object

    Kind: global namespace

    RMPUser.getApplications

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

    Kind: static method of RMPUser
    Returns: Array.<Application> - - List of applications

    Param Type Description
    [login] string User login / email address
    [appContext] string Context in which the application can be used: web, mobile or tablet.
    [mode] string LIVE will return the applications in LIVE version, ACCEPTANCE the applications in both LIVE and ACCEPTANCE versions, TEST will return an empty array.
    [isTagged] boolean return the JSONObject representing the list of user interfaces group by tag if true

    Example

    var listOfApplications = RMPUser.getApplications("user@runmyprocess.com")
    RMPData.setOutput(listOfApplications);
    

    RMPUser.getLanes

    Returns 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.

    Kind: static method of RMPUser
    Returns: Array.<Lane> - - List of Lanes.

    Param Type Description
    [login] string User login / email address

    Example

    var listOfLanes = RMPUser.getLanes("user@runmyprocess.com");
    RMPData.setOutput(listOfLanes);
    

    RMPUser.getLaneUsers

    Returns 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

    Kind: static method of RMPUser
    Returns: Array.<UserData> - - List of Users.

    Param Type Description
    poolId number Pool/Organization identifier
    laneId number Lane/Role identifier
    pageSize number Number of users returned
    skip number start pointer for pagination purposes

    Example

    var listOfLaneUsers = RMPUser.getLaneUsers(112,5701,5,20);
    RMPData.setOutput(listOfLaneUsers);
    

    RMPUser.getManager

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

    Kind: static method of RMPUser
    Returns: String - - Login / email address of a manager
    Throws:

    • Error - No manager found
    Param Type Description
    login string User login / email address
    [level] number Number of levels of hierarchy. Default: 1

    Example

    var theUsersManager = RMPUser.getManager("user@rmp.com",1);
    RMPData.setOutput(theUsersManager);
    

    RMPUser.getUserData

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

    Kind: static method of RMPUser
    Returns: UserData - - Login / email address of a manager

    Param Type Description
    [login] string User login / email address

    Example

    var theUser = RMPUser.getUserData("john@doe.com");
    RMPData.setOutput(theUser);
    

    RMPUser.getUserLanes

    Returns the list of users pertaining to a lane.

    Kind: static method of RMPUser
    Returns: Array.<Lane> - - List of lanes

    Param Type Description
    login string User login / email address

    Example

    var userLanes = RMPUser.getUserLanes("john@doe.com");
    RMPData.setOutput(userLanes);
    

    RMPUser.hasRightInLane

    Checks 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.

    Kind: static method of RMPUser
    Returns: boolean - - 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

    Param Type Description
    [login] string User login / email address or current user
    laneId number Lane/Role identifier

    Example

    var doesBelongToLane = RMPUser.hasRightInLane("user@runmyprocess.com",5701);
    RMPData.setOutput(doesBelongToLane);
    

    RMPUser.getUserMetaData

    Returns the metadata of a user.

    Kind: static method of RMPUser
    Returns: Object - - The User's metadata data

    Param Type Description
    [login] string User login / email address or current user

    Example

    var userMetaData = RMPUser.getUserMetaData();
    RMPData.setOutput(userMetaData);
    

    RMPUser.saveUserMetaData

    Update the metadata of a user.

    Kind: static method of RMPUser
    Returns: string - - Login of the user

    Param Type Description
    [login] string User login / email address or current user
    metadata Object New metadata settings

    Example

    var newMetadata = {"name":"user", "age":22, "car":null};
    var login = RMPUser.saveUserMetaData("user@runmyprocess.com", newMetadata);
    RMPData.setOutput(login);
    

    RMPUser.getUserPreferences

    Returns the preferences associated with a user.

    Kind: static method of RMPUser
    Returns: Object - - the User's preferences

    Param Type Description
    [login] string User login / email address or current user

    Example

    var preferences = RMPUser.getUserPreferences("user@runmyprocess.com");
    RMPData.setOutput(preferences);
    

    RMPUser.saveUserPreferences

    Update the metadata of a user.

    Kind: static method of RMPUser
    Returns: string - - Login of the user

    Param Type Description
    preferences Object New preferences settings

    Example

    var newPreferences = {"elementTest":"DT","Login":"user"};
    var login = RMPUser.saveUserPreferences(newPreferences);
    RMPData.setOutput(login);
    

    RMPUser.impersonate

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

    Kind: static method of RMPUser
    Returns: string - - Login of the user

    Param Type Description
    login string User login

    Example

    var login = RMPUser.impersonate("someUserEmail@runmyprocess.com");
    var metadata = RMPUser.getUserMetaData();
    RMPData.setOutput(metadata);
    

    Application

    Object

    Kind: global typedef
    Properties

    Name Type Description
    id number application ID
    customer number customer ID
    basket number Number of basket items
    basketId number Basket ID
    visibility string PRIVATE or PUBLIC
    header_title string Header Title
    favicon string URL of the application's favicon
    thumb string URL of the application's thumbnail
    icon string URL of the application's icon
    description string Description of the application
    title string The application name
    url string the target URL of the application
    tags string tags

    Lane

    Object

    Kind: global typedef
    Properties

    Name Type Description
    id string Lane ID
    name string Name of the lane

    UserData

    Object

    Kind: global typedef
    Properties

    Name Type Description
    name string Name of the user
    status string Activation status of the user
    login string Login / email address of the user
    profile string The user's profile e.g. Admin
    lang string the user's preferred language
    client_lang string the user's language settings
    restrictions string access restrictions configured for the user
    i18n string the i18n setting for applications
    [alias] Array.<string> the list of aliases associated with the user
    [delegators] Array.<Object> the list of delegations

    Objects

    RMPUtilities

    Typedefs

    CSVOptions

    RMPUtilities : object

    Kind: global namespace

    RMPUtilities.csvToJson

    Converts a CSV string into a JSON array of objects.

    Kind: static method of RMPUtilities
    Returns: string - - A string containing the cvs data in json format the keys of the object correspond to the column headers.
    Throws:

    • Error - Throws an error if the CSV data is empty or invalid.
    Param Type Description
    csvData string The input CSV formatted string.
    optionList CSVOptions Options to be used for the transformation

    Example

    var result = RMPUtilities.csvToJson( '1,true,hello\n2,false,world', {});
    RMPData.setOutput(result);
    

    RMPUtilities.jsonToCsv

    Converts a JSON object or array into a CSV formatted string.

    This method takes a JSON array of objects and converts it into a comma-separated values (CSV) string. The function assumes that all objects in the input array have the same set of keys.

    If the input is invalid or empty, this method may return an empty string or throw an error depending on implementation.

    Kind: static method of RMPUtilities
    Returns: string - A string representing the data in CSV format.
    Throws:

    • Error - Throws an error if the JSON data is empty or invalid.
    Param Type Description
    jsonData Array.<Object> The JSON data to be converted into CSV format.
    optionList CSVOptions Options to be used for the transformation

    Example

    var result = RMPUtilities.jsonToCsv( [["1","true","hello"],["2","false","world"]], {});
    RMPData.setOutput(result);
    

    RMPUtilities.decrypt

    Decrypts an encrypted string using the predefined decryption mechanism.

    This function takes an encrypted string and processes it to return the original plaintext, utilizing the specified cryptographic algorithm and a pre-configured secret key or configuration.

    Kind: static method of RMPUtilities
    Returns: string - The decrypted plaintext string.
    Throws:

    • Error Throws an error if the decryption fails, such as when the encrypted data is corrupted or the configuration is invalid.
    Param Type Description
    encryptedData string The encrypted string that needs to be decrypted.
    vector string The initialization vector
    key string Key to decrypt the ciphered text in AES format
    [algorithm] string Cipher algorithm (e.g. AES, AES/CBC/PKCS5Padding, DES, RSA, Blowfish ). Default: "AES/CBC/PKCS5Padding"

    Example

    var result = RMPUtilities.decrypt("HtcLaNk0xk/G+DjClefgdA==","LqME74+sChTIcYsaUMkBPw==","0ckdURPMf4P4ismngaFgZbX3CGzJCyuR6hTgEAL9RTc=");
    RMPData.setOutput(result);
    

    RMPUtilities.encrypt

    Encrypts a given input string using a specified encryption algorithm.

    This function takes a plain text input string and applies an encryption process to convert it into a secure, encoded format. It may use a default or provided encryption algorithm depending on the implementation. The output will typically be a non-readable string that can only be decrypted using the corresponding decryption method.

    Kind: static method of RMPUtilities
    Returns: Object - The encrypted string.
    Throws:

    • Error Throws an error if the encryption fails.
    Param Type Description
    input string The plain text input to be encrypted.
    key string Key to encrypt the ciphered text in AES format
    [algorithm] string Cipher algorithm (e.g. AES, AES/CBC/PKCS5Padding, DES, RSA, Blowfish ). Default: "AES/CBC/PKCS5Padding"

    Example

    var result = RMPUtilities.encrypt('hello world', 'c7ZOu5rr3fMHTOAAwwlFD049PBVAZ6SU8UJuU3A9lVM=');
    RMPData.setOutput(result);   // e.g. {"encrypted": "{Base64String}", "iv": "{Base64String}"}
    

    RMPUtilities.rsaHash

    Computes an RSA hash for the given input data and returns the hash value.

    This function is used for cryptographic operations such as secure ingestion and validation of data. The RSA hash is usually used in scenarios where data integrity and security are critical.

    Kind: static method of RMPUtilities
    Returns: string - The generated RSA hash as a Base64-encoded string.
    Throws:

    • Error Throws an error if the hashing operation or key processing fails.
    Param Type Description
    input string The input data to be hashed.
    key string The private key readers supports PEM files with PKCS#8 or PKCS#1 encodings. It doesn't support encrypted PEM files
    hashAlgorithm string e.g. SHA256 (default), MD5, SHA1

    Example

    var key ='-----BEGIN RSA PRIVATE KEY-----\n' +
             '....\n' +
             '-----END RSA PRIVATE KEY-----';
    var result = RMPUtilities.rsaHash('hello world', key, 'SHA256', 'HEXA');
    RMPData.setOutput(result);   // e.g. {"encrypted": "{Base64String}", "iv": "{Base64String}"}
    

    RMPUtilities.uuid

    Generates a universally unique identifier (UUID).

    This function creates a UUID string based on the Version 4 specification. UUIDs are 128-bit identifiers used to uniquely identify information in distributed systems. It ensures randomness and uniqueness, making it suitable for use in various applications requiring unique identifiers, such as databases or tokens.

    Kind: static method of RMPUtilities
    Returns: string - A randomly generated UUID in the standard format (e.g., "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"), where x is a hexadecimal digit and y represents one of several possible values as per the specification.

    Example

    var result = RMPUtilities.uuid();
    RMPData.setOutput(result);
    

    RMPUtilities.generateJWT

    Generates a JSON Web Token (JWT) based on the provided claims, header, and options.

    This method creates a signed token using the specified payload and secret key. It is commonly used for authentication and authorization purposes in web applications.

    Kind: static method of RMPUtilities
    Returns: string - The generated JWT as a signed token string.
    Throws:

    • Error Throws an error if the payload or secret key validation fails or the token generation process encounters an issue.
    Param Type Description
    header Object JWT header
    claims Object JWT claims (Note: the "iat" (current time) is added per default)
    expirationInSecs number The expiration time in seconds
    operation string Reference to the private key that you uploaded via API
    signatureAlgorithm string none, HS256, HS384, HS512, RS256, RS512, ES256, ES384, PS256, PS384, PS512

    Example

    var header = {};
    var claims = { "iss": ".....",
                   "sub": ".....",
                   "aud": "account-d.docusign.com",
                   "scope": "impersonation signature"};
    var jwt = RMPUtilities.generateJWT(header, claims , 3600, 'DOCUSIGN', 'RS256');
    RMPData.setOutput(jwt);
    

    CSVOptions

    Object

    Kind: global typedef
    Properties

    Name Type Description
    [separator] string Separator between two values (e.g. ; or ,). Default: ,
    [delimiter] string Used to allow values containing a separator character (e.g. " or '), to include a delimiter in a value, use two delimiters (e.g. ""). Default: "
    [empty] string Value to be used to represent an empty value (two separators in a row). Default: ""
    [charset] string Character set to be used to read the file content. Default: UTF-8
    [parse_numbers] Array Names/indices of columns containing numerical values to be stored as Double. e.g ["age",3] will parse columns header "age" and the 4th column
    [parse_longs] Array Names/indices of columns containing long values to be stored as Long. e.g: ["age",3] will parse column header "age" and the 4th column.
    [parse_numbers] Array Names/indices of columns containing numerical values to be stored as Double. e.g ["age",3] will parse columns header "age" and the 4th column
    [parse_longs] Array Names/indices of columns containing long values to be stored as Long. e.g: ["age",3] will parse column header "age" and the 4th column.
    [trim] boolean Trim values before inserting them in the collection. Trimming also occurs before decoding numerical values.