Methods
-
get_access_url(includeProtocol) → {string}
Get the URL of the RunMyProcess server.
-
Parameters:
Name Type Description includeProtocol
boolean Whether or not including the protocol in the URL Returns:
URL with or without protocol- Type
- string
Example
${get_access_url(true)} = https://live.runmyprocess.com/ ${get_access_url(false)} = live.runmyprocess.com/
-
get_custom_list(id) → {array}
Get the content of a custom list.
-
Parameters:
Name Type Description id
string Identifier of a custom list Returns:
List un a JSONArray format- Type
- array
-
get_i18n(key, defaultValue, language) → {string}
Internationalization method. Get the translation of a key in a given language. With this method, you can enforce the language type. Unlike the i18n() method, it applies to all process activities, not only to email activities.
-
Parameters:
Name Type Argument Description key
string - defaultValue
string <optional>
Default value if key is not found in language language
string <optional>
Language code (two letters) Returns:
Target translation or defaultValue if nothing found.- Type
- string
-
get_next_url(stepId, is_public, context) → {string}
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.
Parameters:
Name Type Argument Default Description stepId
integer The id of the step as defined in the process design is_public
boolean Use a public task template or not context
string <optional>
web If context=mobile, the generated URL will be adapted to the the RunMyApp environment Returns:
Task URL- Type
- string
-
get_parent_params() → {object}
Retrieves all parameters from the parent process request.
-
Retrieves all parameters from the parent process request. Do not indicate any target parameter name to inject all parameters directly into the context of the current process request.
Returns:
Parent process' parameters- Type
- object
-
get_project_metadata(projectId) → {object}
Get the metadata of a project.
-
Parameters:
Name Type Argument Description projectId
integer <optional>
Identifier of the project. By default the project of the current process request is used. Throws:
Project not foundReturns:
Project metadata- Type
- object
-
get_request_info(id) → {object}
Describe a process request.
-
Parameters:
Name Type Argument Description id
string <optional>
Identifier of the process request to describe. By default the descriptor of the current process request is provided. Throws:
Request not foundReturns:
Process request descriptor- Type
- object
-
get_task_url(is_public) → {string}
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.
Parameters:
Name Type Description is_public
boolean Use a public task template or not Returns:
Task URL- Type
- string
-
inject_params() → {object}
Add the result of the last executed task to the context of a process request.
-
Returns:
Result of the last executed task- Type
- object
-
next_value(name) → {integer}
Get the next value of a named and persistent counter.
-
Get the next value of a named and persistent counter. The counter is created and initialized at 0 id it doesn't exists
Parameters:
Name Type Description name
string Name of the counter Throws:
Counter already being modified, cannot increment itReturns:
Next value- Type
- integer
-
P_add_user_to_lane(laneId, userId) → {array}
Add a user to the given runtime lane.
-
Parameters:
Name Type Description laneId
integer Id of the lane userId
integer/string Id or login of the user - See:
-
- request#P_remove_user_from_lane
Returns:
List of the users id in the lane- Type
- array
-
P_delete_project_vault() → {boolean}
Delete a project vault
-
- See:
-
- request#P_save_project_vault
Returns:
True if the project vault has been found and deleted, false otherwise.- Type
- boolean
-
P_get_oauth2_token(service) → {object}
Retrieve an OAuth2 service token
-
Parameters:
Name Type Description service
string Name of the OAuth2 service which token is to be retrieved - See:
-
- request#P_save_oauth2_token
Returns:
The OAuth2 token associated to 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: `${P_get_oauth2_token("my_service").access_token}`. An OAuth2 service token value depends on the current request execution mode.- Type
- object
-
P_load_project_vault() → {object}
Retrieve the project vault associated to the project containing the current request
-
- See:
-
- request#P_save_project_vault
Returns:
The current request project vault. A project vault value depends on the current request execution mode.- Type
- object
-
P_log(message) → {string}
Equivalent to P_log('FINEST', message).
-
Parameters:
Name Type Description message
string Message to be logged. Returns:
Logged message- Type
- string
-
P_log(level, message) → {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.
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
-
P_remove_user_from_lane(laneId, userId) → {array}
Remove a user from the given runtime lane.
-
Parameters:
Name Type Description laneId
integer Id of the lane userId
integer/string Id or login of the user - See:
-
- request#P_add_user_to_lane
Returns:
List of the users id in the lane- Type
- array
-
P_save_oauth2_token(service, token) → {object}
Modify or create an OAuth2 service token
-
Parameters:
Name Type Description service
string Name of the OAuth2 service which token is to be modified token
object Token object associated to the specified service. This object must contain at least a field name access_token containing the OAuth2 access token. It may also contain a refresh_token field and an expires_in field, containing an OAuth2 refresh token and a token lifetime duration, or any extra fields. - See:
-
- request#P_get_oauth2_token
Returns:
The updated token associated to the specified service.- Type
- object
-
P_save_project_vault(vault) → {object}
Modify or create a project vault
-
Parameters:
Name Type Description vault
object An object representing the vault associated to project containing the current request. This object may contain any fields. - See:
-
- request#P_load_project_vault
Returns:
The updated project vault.- Type
- object
-
P_set_request_status(statusCode)
Set the status of the current request to the statusCode.
-
Parameters:
Name Type Description statusCode
integer 102/201/301/302/400/401 -
R_lock(lockname, wait_timeout, exec_timeout) → {string}
Lock a resource.
-
Create 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 This JSONArray will contain a list of the following structure: P_locks:[{ name: (name of the lock), start: (time stamp when the lock was owned) }]
Parameters:
Name Type Argument Description lockname
string Name of the lock wait_timeout
integer <optional>
Maximun time to wait to get the lock (in milliseconds). If this number is greater than 40 seconds, the method will wait only 40 seconds. exec_timeout
integer <optional>
Maximun time that the lock could be kept if not release programmatically (in seconds). Default: 1 hour - See:
-
- request#unlock
Throws:
Timeout exception if the request don't get the lockReturns:
Name of the lock- Type
- string
-
R_read_file_add_lane(file, lane)
Add lanes allowed to READ the file(s).
-
Parameters:
Name Type Description file
array | string One or a list of file identifiers. lane
array | string | number One lane identifier or a list of lane identifiers. Default is the lane of the request. 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]}...} -
R_read_file_add_user(file, user)
Add users allowed to READ the file(s).
-
Parameters:
Name Type Description file
array | string One or a list of file identifiers. user
array | string | number One user identifier, or one user login, or a list of either user identifiers or user logins. Default is the connected user. 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]}...} -
R_read_file_remove_lane(file, lane)
Remove lanes allowed to READ the file(s).
-
Parameters:
Name Type Description file
array | string One or a list of files identifiers. lane
array | string | number One lane identifier or a list of lane identifiers. Default is the lane of the request. 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]}...} -
R_read_file_remove_user(file, user)
Remove users allowed to READ the file(s).
-
Parameters:
Name Type Description file
array | string One or a list of files identifiers. user
array | string | number One user identifier, or one user login, or a list of either user identifiers or user logins. Default is the connected user. 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]}...} -
R_unlock(lockname) → {string}
Release a lock.
-
Release a lock acquired with `$R_lock(lockname, wait_timeout, exec_timeout)}`. Datadocument: The use of the method lock and/or unlock will add in the internal parameter a JSONArray with the key P_locks This JSONArray will contain a list of the following structure: P_locks:[{ name: (name of the lock), start: (time stamp when the lock was owned), end: (time stamp when the lock was released) }]
Parameters:
Name Type Description lockname
string Name of the lock - See:
-
- request#lock
Returns:
Name of the lock- Type
- string
-
R_update_file_add_lane(file, lane)
Add lanes allowed to WRITE/DELETE the file(s).
-
Parameters:
Name Type Description file
array | string One or a list of files identifiers. lane
array | string | number One lane identifier or a list of lane identifiers. Default is the lane of the request. 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]}...} -
R_update_file_add_user(file, user)
Add users allowed to WRITE/DELETE the file(s).
-
Parameters:
Name Type Description file
array | string One or a list of files identifiers. user
array | string | number One user identifier, or one user login, or a list of either user identifiers or user logins. Default is the connected user. 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]}...} -
R_update_file_remove_lane(file, lane)
Remove lanes allowed to WRITE/DELETE the file(s).
-
Parameters:
Name Type Description file
array | string One or a list of files identifiers. lane
array | string | number One lane identifier or a list of lane identifiers. Default is the lane of the request. 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]}...} -
R_update_file_remove_user(file, user)
Remove users allowed to WRITE/DELETE the file(s).
-
Parameters:
Name Type Description file
array | string One or a list of files identifiers. user
array | string | number One user identifier, or one user login, or a list of either user identifiers or user logins. Default is the connected user. 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]}...} -
save_custom_list(listId, data) → {array}
Update a custom list with a new content.
-
Parameters:
Name Type Description listId
string Identifier of the custom list to be modified data
array New content of the custom list Throws:
Custom list not foundReturns:
New content- Type
- array
-
throw(message)
Throw an error.
-
Parameters:
Name Type Argument Description message
string <optional>
Error message Throws:
An error with the given error message