The PMDynaform.getUserInfo() method retrieves an object with logged on user information.
Parameters:
Return Value:
object: This object has the following string-type properties:
Example 1:
ProcessMaker Web Edition:
Example 2:
ProcessMaker Web Edition:
The PMDynaform.getEnvironment() method retrieves the environment where the Dynaform is executed.
Parameters:
Return Value:
Example 1:
ProcessMaker Web Edition:

ProcessMaker Mobile:

Example 2:
When the following JavaScript code is executed, the function will return a different message depending on the environment that the Dynaform is running on.
ProcessMaker Web Edition:

ProcessMaker Mobile:

The PMDynaform.getWorkspaceName() retrieves the workspace name, which is "workflow" by default. This method is useful when running a Dynaform on ProcessMaker Mobile where the workspace name is not shown in the URL.
Parameters:
Return Value:
Example:
ProcessMaker Web Edition:

ProcessMaker Mobile:

PMDynaform.getAccessToken() retrieves the current user's REST login session access token. Information about the access token value can be reviewed in the wf_<workspace>.OAUTH_ACCESS_TOKENS table.
Parameters:
Return value:
Example:
ProcessMaker Web Edition:

ProcessMaker Mobile:

PMDynaform.getHostName() retrieves the hostname of the server where ProcessMaker is installed. This method is especially useful in ProcessMaker Mobile where the hostname is not obtainable from the URL.
Parameters:
Return value:
Example:
ProcessMaker Web Edition:

ProcessMaker Mobile:

When creating a ProcessMaker REST API, it is necessary to first obtain an access token from OAuth 2.0 to call ProcessMaker REST endpoints.
However, ProcessMaker also uses access tokens to consume its own services. It is possible to consume a REST endpoint from inside ProcessMaker using these same access tokens with the help of the Environment Helpers, as long as the tokens stay active.
To consume a REST enpoint from inside ProcessMaker, the code should include:
Example 1:
The example below explains how to retrieve the existing roles from the current workspace using a REST endpoint.
Create a Dynaform with a "roles" text area and a "getRoles" button.

The endpoint URL to retrieve all the roles in a current workspace is:
To set this URL, the following code uses the helpers PMDynaform.getHostName(), PMDynaform.getWorkspaceName() and PMDynaform.getAccessToken() to get the hostname, workspace and access token respectively.
Place the code in the javascript property of the Dynaform.
When clicking the "Get Roles" button, the JavaScript code will retrieve all the roles in the current workspace and it will set the role list in the "roles" text area.

Example 2:
If a REST endpoint doesn't send back any response when it is successfully executed, then jQuery's .ajax() function takes that empty response and tries to call JSON.parse() on an empty string, which causes an error message like:
To avoid this problem, set dataType: "text", which is tells jQuery.ajax() that the endpoint will return text, so it shouldn't call JSON.parse(). If the endpoint is successful, then do nothing. If it is unsuccessful and it has returned a responseText, then call JSON.parse() to get the error object.
For example the following JavaScript code executes the PUT /cases/{app_uid}/execute-trigger/{tri_uid} endpoint which doesn't return a response if it is executed successfully. Notice how the code sets a handler function for errors.
Automate your Workflow with Business Process Management
Privacy Statement
© Copyright 2000-2026 Decisions All rights reserved.

