Please rate how useful you found this document: 
Average: 2.3 (4 votes)

Task Functions

PMFTaskList()

PMFTaskList() returns the list of tasks the specified user has initiated.

array PMFTaskList(string userId)

Parameters:

  • string userId: The unique ID of a user.

Return value:

An array of tasks, with the following structure:

[0] array ( associative array ( [string guid] [string name] [string processId] [int initialTask] ) ) ...

Where:

  • string guid: The unique ID of a task.
  • string name: The name of a task.
  • string processId: The unique ID of the process.
  • int initialTask: Set to 1 if the task is an initial task. Otherwise, set to 0.

Example:
Get the unique ID of the task whose name is "Verify Data" and place it in the @@taskId variable:

$aTasks = PMFTaskList(@@USER_LOGGED);
foreach ($aTasks as $aTask) {
   if ($aTask['name'] === 'Verify Data')
       @@taskId = $aTask['guid'];
}

PMFTasksListByProcessId()

PMFTasksListByProcessId() retrieves the UID and the names of all the tasks in a Process.

array PMFTasksListByProcessId(string processUID, string Language)

Parameters:

  • string processUID: (Required) The unique ID of the process, which can be found in the following ways:
    • Use the @@PROCESS system variable to get the unique ID of the current process.
    • Use the PMFProcessList() function or processList() web service.
    • Query the wf_<WORKSPACE>.PROCESS.PRO_UID field in the database or use a query like:
      SELECT PRO_UID FROM PROCESS WHERE PRO_TITLE = 'Expense Report Process'
  • string Language: (Required) The language used to display the name of the task. If not included, it will be English ('en') by default.

Return Value:

An array of associative arrays. Each one of these arrays contains the UID and the name of each task in the process. The array has the following structure:

[0] array ( associative array ( [string TAS_UID] [string TAS_TITLE] ) ) ...

Example:

@@ArrayTasks = PMFTasksListByProcessId(@@PROCESS, @@SYS_LANG);

In this case, the return value stored in @@ArrayTasks will show the following information:

Array ( [0] => Array ( [TAS_UID] => 14850126058f50499a508e6011635086 [TAS_TITLE] => Task 1 ) [1] => Array ( [TAS_UID] => 22631919158f504994e4669079649122 [TAS_TITLE] => Task 2 ) [2] => Array ( [TAS_UID] => 31790824558f504c140bd07034804777 [TAS_TITLE] => Task 3 ) )

PMFGetTaskName()

PMFGetTaskName() retrieves the name of a task using the unique ID of the task and given language.

string PMFGetTaskName(string taskId, string Language)

Parameters:

  • string taskId: The unique ID of the task, which can be found in the following ways:
    • Use the @@TASK system variable to get the unique ID of the current task.
    • Use the PMFTaskList() function or taskList() web service.
    • Query the wf_<WORKSPACE>.TASK.TAS_UID field in the database with executeQuery().
  • string Language: Optional parameter. The language in which the task name will be retrieved. If not specified then the default system language is used.

Note: Please take into account that returned values directly depend on the current data stored in the wf_<WORKSPACE>.TASK table, and more specifically records related to task titles (TAS_TITLE).

Return value:

  • string: The function returns the name of the task.

Example:

@@taskName = PMFGetTaskName(@@TASK,'es');

The returned value stored in @@taskName will be "Recibir Factura".

PMFGetTaskUID()

PMFGetTaskUID() retrieves the unique ID of a task using the task name and, if required, the unique ID of the process.

string PMFGetTaskUID(string taskName, string processUID)

Parameters:

  • string taskName: The name of the task. Remember that task names are case sensitive and can contain spaces.
    • string processUID: (Optional) The unique ID of the process, where the task is found. If not included or set to null, then assumes that the task is located in the current process. The process UID can be found in the following ways:
      • Use the @@PROCESS system variable to get the unique ID of the current process.
      • Use the PMFProcessList() function or processList() web service.
      • Query the wf_<WORKSPACE>.PROCESS.PRO_UID field in the database or use a query like:
        SELECT PRO_UID FROM PROCESS WHERE PRO_TITLE = 'Receive Invoice'

    Return value:

    The function returns the unique ID of the task (which is a string of 32 hexadecimal numbers). If not found, then it returns false.

    Example:

    @@taskUID = PMFGetTaskUID("Receive invoice",'75150592456d5efe4848088021942802');

    The returned value stored in @@taskUID will be '52043657456d5f00ed2e468062806376'.

    PMFAddUserGroupToTask()

    PMFAddUserGroupToTask() adds a user or group to the list of users assigned to a task. Note that if the user or group is already assigned then it cannot be assigned again. This function defines internally if the sent UID is from a user or a group.

    int PMFAddUserGroupToTask(string taskUID, string userGroupUID)

    Parameters:

    • string taskUID: The unique ID of the task, which can be found in the following ways:
      • Use the @@TASK system variable to get the unique ID of the current task.
      • Use the PMFTaskList() function or taskList() web service.
      • Query the wf_<WORKSPACE>.TASK.TAS_UID field in the database or get the starting task of the current process with the following query:
    • executeQuery("SELECT TAS_UID FROM TASK WHERE PRO_UID='" . @@PROCESS . "' AND TAS_START='TRUE'");
    • string userGroupUID: The unique ID of a group, which can be found in the following ways:
      • Use the PMFGroupList() or WSGroupList() functions or the groupList() web service.
      • Query the wf_<WORKSPACE>.GROUPWF.GRP_UID field in the database.
      • Use the query:
        SELECT GRP_TITLE, GRP_UID FROM GROUPWF

    Return Value:
    Returns 1 if the user/group was assigned successfully; otherwise, returns 0 if an error occurred.

    PMFRemoveUserGroupFromTask()

    PMFRemoveUserGroupFromTask() removes a user or group from the list of users assigned to a task. This function defines internally if the sent UID is from a user or a group.

    int PMFRemoveUserGroupFromTask(string taskUID, string userGroupUID)

    Parameters:

    • string taskUID: The unique ID of the task a user or group will be removed from, which can be found in the following ways:
      • Use the @@TASK system variable to get the unique ID of the current task.
      • Use the PMFTaskList() function or taskList() web service.
      • Query the wf_<WORKSPACE>.TASK.TAS_UID field in the database or get the starting task of the current process with the following query:
        executeQuery("SELECT TAS_UID FROM TASK WHERE PRO_UID='" . @@PROCESS . "' AND TAS_START='TRUE'");
    • string userGroupUID: The unique ID of a user or group that will be removed from the list of assignees, which can be found in the following ways:
      • Use the PMFGroupList() or WSGroupList() functions or the groupList() web service.
      • Query the wf_<WORKSPACE>.GROUPWF.GRP_UID field in the database.
      • Use the query:
        SELECT GRP_TITLE, GRP_UID FROM GROUPWF

    Return Value:
    Returns 1 if the user/group was assigned successfully; otherwise, returns 0 if an error occurred.