- 1. Overview
- 2. Process Functions
- 3. Task Functions
- 4. Dynaform and Field Functions
- 5. Case Functions
- 6. Case Routing Functions
- 7. Case Notes Functions
- 8. User Functions
- 9. Group Functions
- 10. Email Functions
- 11. Document Functions
- 12. Unique ID Functions
- 13. Date Functions
- 14. String Functions
- 15. Database Functions
- 16. Grid Functions
Unique ID Functions
generateCode()
generateCode()
creates a random string of letters and/or numbers of a specified length, which can be used as the PIN (public identification numbers) and code for a cases. For more info, see setCaseTrackerCode().
Parameters:
- int size: The number of characters to be generated, which can cannot be less than 4 or greater than 50.
- string type: The type of of characters to be generated, which can be 'ALPHA' (only letters), 'NUMERIC' (only numbers), and 'ALPHANUMERIC' (both letters and numbers).
Return Value:
The generated string of random characters.
Note: There is no way to know whether the string returned by generateCode()
is unique, so do not use this function to uniquely identify any object in ProcessMaker. For that purpose, use the G::generateUniqueID()
function.
Example:
Create a random alphanumeric string, like "4NJQEWPT89AH":
PMFGeti18nText()
PMFGeti18nText()
returns the translation of a property of an object in ProcessMaker in a specified language. For example, this function can be used to look up the French translation of a task's title and description. These translations were entered by the process designer and stored in the wf_WORKSPACE.CONTENT
table of the database.
Parameters:
- string ID: The unique ID of the object whose property will be looked up to find a translation.
- string category: The category of the property to be looked up, such as
'GRP_TITLE'
(a group's title) or'INP_DOC_DESCRIPTION'
(an Input Document's description). See this list of the available categories. - string lang: Optional. The code of the language to be retrieved, such as
'es'
(Spanish) or'pt-BR'
(Brazilian Portuguese). Use the@@SYS_LANG
system variable to look up the translation in the current system language of the user logged in. If not included, then will return English by default.
Return Value:
Returns the translation stored in the CON_VALUE
field of the CONTENT
table.
Example:
Look up the description in Spanish of a trigger with the unique ID "63754922456d8c321a978c6078216529":
Which will get the text in Spanish as seen in the image below.
If the same text in French (from France) is needed:
The text in French will be retrieved, as seen in the image below.
Note: Note that this function will only return a translation in the specified language if there is one stored in the wf_WORKSPACE.CONTENT
table.
PMFGetUidFromText()
PMFGetUidFromText()
returns the unique ID of a process element by searching for its text (name, title, description, etc.) in the CONTENT
table in the workspace's database. Multiple results may be returned.
Parameters:
- array text: The text of the element to search for in the CONTENT.CON_VALUE field in the database, such as the name of a group, department, role, permission, task, process, etc.
- string category: The category of the text, which is stored in the CONTENT.CON_CATEGORY field in the database. The available categories are:
Category Description 'APP_TITLE' The title of a case, which contains the case number by default, but can be set in the task properties in the process. 'APP_DESCRIPTION' Case description, which can be set in the task properties in the process. 'APP_DOC_COMMENT' The comment added to an uploaded file in an Input Document. 'APP_DOC_FILENAME' The filename of a file that is uploaded to an Input Document or File field, or generated as an Output Document. 'APP_DOC_TITLE' The title of a file associated with a case. This feature is outdated and no longer used in version 3 and later. 'PRO_TITLE' Process title. 'PRO_DESCRIPTION' Process description 'TAS_TITLE' Task title, set in the task's properties under Definitions. 'TAS_DESCRIPTION' Task description, set in the task's properties under Definitions. 'TAS_DEF_SUBJECT_MESSAGE' The subject line of an email, which is set in the task's properties under Notifications. 'TAS_DEF_MESSAGE' The body of an email, which is set in the task's properties under Notifications. 'TAS_DEF_TITLE' The title of the case when it arrives at the task, which is set in the task's properties under Case Labels. 'TAS_DEF_DESCRIPTION' The description of the case when it arrives at the task, which is set in the task's properties under Case Labels. 'TAS_DEF_PROC_CODE' Task property to assign a code. This feature is outdated and no longer used in version 3 and later. 'DYN_TITLE' Dynaform title. 'DYN_DESCRIPTION' Dynaform description. 'GRP_TITLE' Group title. 'DEPO_TITLE' Department title. 'INP_DOC_TITLE' Input Document title. 'INP_DOC_DESCRIPTION' Input Document description. 'OUT_DOC_TITLE' Output Document title. 'OUT_DOC_DESCRIPTION' Output Document description. 'OUT_DOC_FILENAME' Output Document filename, set in the definition of the Output Document. For the filename of a generated Output Document file, use 'APP_DOC_FILENAME'
.'OUT_DOC_TEMPLATE' The HTML code of the template of the Output Document. 'PER_NAME' Name of a role's permission. For example, the PM_REASSIGNCASE permission has the name "Reassign case". 'ROL_NAME' Name of the role. For example, the PROCESSMAKER_MANAGER role has the name "Manager". 'TRI_TITLE' Trigger title. 'TRI_DESCRIPTION' Trigger description. - string processUID: (Optional) The unique ID of the process, which can be found by running a case and looking at the
PROCESS
system variable in the Debug Mode. This parameter should be set if elements in multiple processes may have the same text, such as tasks that may have the same title in two different processes. For the current process, set to the@@PROCESS
system variable. If @@PROCESS is not included, the current process where the function is executed will be used. - string lang: (Optional) The language code, such as 'es' (Spanish) or 'pt-BR' (Portuguese from Brazil, which is searched for in the CONTENT.CON_LANG field in the database. The @@SYS_LANG system variable can be used to retrieve the language of the workspace. If @@SYS_LANG is not included, the default language of the workspace will be used.
Return Value:
An array with the unique IDs of the matching element(s) found in the CONTENT table.
Example 1:
Retrieve the ID of a task entitled "Review application" in the current process.
PMFGetUidFromText()
:
$aTasks = PMFGetUidFromText($taskTitle, 'TAS_TITLE', @@PROCESS, 'en');
if (count($aTasks) == 0) {
throw new Exception("Error: Task '$taskTitle' is not found.");
}
$taskUID = $aTasks[0];
Example 2:
The following example gets a list of IDs of the users in a group, so it can set the @=assignedUsers
variable used by a task with Self Service Value Based Assignment. PMFGetUidFromText()
is used to search for the ID of the group with the title "Factory Managers". After checking with count()
that at least one record was returned, then it uses Group::getUsersOfGroup()
to get the list of users in a group. It then assigns the IDs of these users to the @=assignedUsers
array.