Case Notes Functions

PMFAddCaseNote()

PMFAddCaseNote() adds a case note to a specified case.

int PMFAddCaseNote(string $caseUID, string $processUID, string $taskUID, string $userUID, string $note, int $sendMail = 1)

Parameters:

  • string caseUID: (Required) The unique ID of the case, which can be found in the following ways:
  • string processUID: (Required) The unique ID of the process, which can be found in the following ways:
    • For the current process, use the @@PROCESS system variable.
    • Use executeQuery() to look up the unique ID in the wf_<WORKSPACE>.PROCESS.PRO_UID field.
  • string taskUID: (Required) 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'")
  • $userUID: (Required) The unique ID of the user who will add the case note. Note that it is NOT possible to include the UID of more than one user.
  • $note: (Required) Note of the case.
  • $sendMail: (Optional) If set to 1, will send an email to all participants in the case.

Return Value:
Returns 1 if the note has been successfully added to the case, otherwise returns 0 if an error has occurred.

Example:

@@return = PMFAddCaseNote(@@APPLICATION, @@PROCESS, @@TASK, @@USER_LOGGED, 'Completed with resolution #234',1);

Note: It is possible to use case or system variables in the text of the case note. The following example inserts the resolution number, which is a value from a Dynaform field, into the text of the case note:

@@return = PMFAddCaseNote(@@APPLICATION, @@PROCESS, @@TASK, @@USER_LOGGED, 'Completed with resolution #' . @@NumberResolution, 1);

PMFGetCaseNotes()

PMFGetCaseNotes() returns a list of the case notes posted to a specified case.

array PMFGetCaseNotes(string applicationUID, string type = 'array', string userUID = '')

Parameters:

  • string applicationUID: The unique ID of a case, which can be obtained in the following ways:
    • For the current case, use the system variable @@APPLICATION.
    • Use PMFCaseList(), WSCaseList() or the caseList() web service.
    • Use executeQuery() to query the wf_<WORKSPACE>.APPLICATION.APP_UID or wf_<WORKSPACE>.APP_DELEGATION.APP_UID fields in the database
  • string type: Optional parameter. Set to 'array' if the result will be displayed in a grid. Set to 'string' to return a string, which can be displayed in a textarea field. The default value is 'array'.
  • string userUID: Optional parameter. To return the case notes posted by a single user, set to the unique ID of that user. If no user ID is specified, then it will return the case notes from all users. For the currently logged-in user, use the @@USER_LOGGED system variable.

    Note: It's not possible to define more than one user ID in the last parameter.

Return Value:
If the type is set to 'array', then this function returns an array of associative arrays with the following structure:

[1] array ( string ['FULL_NAME']: First name and last name of the user who created the case note. string ['APP_UID']: Case UID. string ['USR_UID']: User UID. string ['NOTE_DATE']: The datetime when the case note was created in YYYY-MM-DD HH:MM:SS format. string ['NOTE_CONTENT']: The content of the case note. string ['NOTE_TYPE']: The type of the case note. string ['NOTE_AVAILABILITY']: The type of availability of the case note. string ['NOTE_RECIPIENTS']: The users who got the note by notification. string ['USR_USERNAME']: The username of the user who created the case note. ) ...

Note that the counting of the array starts from 1, not 0.

If the $type is set to 'string', then this function returns a string that includes the name and username of the user who posted the case note, the content of the case note, and the date-time when posted:

FIRST-NAME LAST-NAME (USERNAME) NOTE-1-CONTENT (DATE-TIME-POSTED) FIRST-NAME LAST-NAME (USERNAME) NOTE-2-CONTENT (DATE-TIME-POSTED) ...

Showing Case Notes in a Grid

Create a Dynaform and inside it add a grid. When dropping the Grid element, create a new variable named gridPMFunction that is associated to the grid.

Add the following controls inside the grid:

Save the changes and close the Dynaform. Then, create a trigger with the following parameters:

@@gridPMFunction = PMFGetCaseNotes(@@APPLICATION, 'array', '');

Where:

  • @@gridPMFunction: is the name of the grid added inside the Dynaform and where the results will be shown.
  • @@APPLICATION: UID of the current process.
  • array: the results. In the example, the results will be shown in a grid.

Note that the last parameter is empty, so it will display all the case notes created by the users.

Assign the trigger to be executed before the Dynaform created and the results will be shown as seen in the image below:

In this example, the trigger was assigned to the second task, so all case notes added to both the first task and the second task will be displayed on the grid.

Showing Case Notes in a Textbox

Create a Dynaform that has a Textarea control with a variable called textAreaPMFunction.

Then create a trigger as follows:

@@textAreaPMFunction = PMFGetCaseNotes(@@APPLICATION, 'string', '');

Where:

  • @@textAreaPMFunction : name of the textarea added to the Dynaform and where the results will be shown.
  • @@APPLICATION: UID of the current process.
  • string: the results. In the example, the results will be shown in a textarea.

The last parameter is empty, so it will display all the case notes created by the users.

Assign the trigger before the Dynaform. The result will be: