Display parent's case number in label of subprocess case

From pmusers
Jump to: navigation, search

A subprocess case can't have the same case number as its parent case, because the case numbers for each must be unique. However, the case number of the parent case can be passed to the subprocess case and displayed in its case title. This example shows how to pass the parent's case number as a variable.

Subprocess: Receive_parent's_case_number-1.pmx (right click and select Save Link As)
Parent Process: Pass_case_number_to_subprocess-1.pmx (right click and select Save Link As)
Author: Amos Batto (amos@processmaker.com)
Version: 1.0 (2019-05-13)
Tested in: ProcessMaker 3.3.10 Community in Debian 9.5 with PHP 5.6.37

Create a parent process:

PassCaseNoToSubprocess ParentProcess.png

And a subprocess:

PassCaseNumberToSubprocess SubprocessInDesigner.png

Then, add a variable named "parentCaseNo" in both the parent process and the subprocess:

PassCaseNumberToSubprocess CreateVariable.png

Then, in the parent process create the following trigger to save the parent's case number in the variable @@parentCaseNo:

@@parentCaseNo = @@APP_NUMBER;

PassCaseNumberToSubprocess CreateTrigger.png

Then, set this trigger to fire before assignment in "Task 1" of the parent process:

PassCaseNumberToSubprocess SetTriggerToFire.png

Then, go to the properties of the subprocess in the parent process and set the variable @@parentCaseNo to be passed from the parent process to the subprocess:

PassCaseNumberToSubprocess SetVariableToBePassed.png

Finally, open the subprocess and right click on the first task in the subprocess and select Properties in the dropdown menu.

In the "Properties" dialog box that opens, go to the Case Labels section and in the Title field, set: From #@#parentCaseNo

PassCaseNumberToSubprocess AddCaseLabel.png

Then, run a case. When the subprocess case starts, the number from the parent case should appear in the title of the subprocess case in the list of cases. In this example, the number of the parent case is 76 and the subprocess case is 77:

PassCaseNumberToSubprocess InCaseList.png