×

Please give details of the problem

Skip to content

Server-Side Javascript ES6 API Reference

RMPApplication

Methods for the Management of Applications

Attach File

Find the last occurrence of a string in a file.

Syntax : RMPApplication.attachFile(fileIds, widgetId);

Parameters :

Name Type Description
fileIds Array of Strings 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.

Returns : Descriptors of the attached files.

Type : Array

Call Example :

  
    <@script env="js">
      var fileIds = ["fd58e98b-447e-42f8-8a78-24b55d928f3e"];
      var res =  RMPApplication.attachFile(fileIds,"uploadFile_1");
      RMPData.setOutput(res);
    </@script>
   

Detach File

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

Syntax : RMPApplication.detachFile(fileIds,instanceId);

Parameters :

Name Type Description
fileID Array of Strings 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 of JSON objects

Data-Structure:

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

Call Example :

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

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 of Maps

Data-Structure:

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

Call Example :

  
    <@script env="js">
      var instanceId = "4ab793b0-6157-49b7-b95f-3112360a8f9a";
      var res =  RMPApplication.listAttachedFiles( instanceId );
      RMPData.setOutput(res);
    </@script>
   

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

Call Example :

  
    <@script env="js">
      RMPApplication.getHistory();
    </@script>
   

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

Data-Structure:

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

Call Example :

  
    <@script env="js">
      var info = RMPApplication.getInstanceInfo("2518ba82-b617-4e5b-8673-6ba414b19203");
    </@script>
   

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)
  • RMPApplication.getI18n(key, defaultValue)
  • RMPApplication.getI18n(key, defaultValue, language)

Parameters :

Name Type Description
key String -
defaultValue (optional) String Default value if key is not found in language
language (optional) String Language code (two letters)

Returns : Target translation or defaultValue if nothing is found.

Type : String

Call Example :

  
    <@script env="js">
      var res =  RMPApplication.getI18n("Text","defaultVal");
      RMPData.setOutput(res);
    </@script>