Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderators: ArturoRobles, ArturoRobles

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
I am trying to display a checkgroup in an output document.
I have tried all the forum solutions, and can't get it working.
The output doc does not show the checkboxes (checked or unchecked) in work or pdf

Would be gratefull if someone has a working example they could upload ?

this is the example i am currently testing (PM 3.1)

Checkgroup Dynaform Variable = CurrentOutpatientTreatmentOrder
Key = 1 Label = MarkOrder1
Key = 2 Label = MarkOrder2
Key = 3 Label = MarkOrder3

Output Doc HTML
Code: Select all
<input  type="checkbox" value="1" @#MarkOrder1> Option 1<br>
<input  type="checkbox" value="2" @#MarkOrder2> Option 2<br>
<input  type="checkbox" value="3" @#MarkOrder3> Option 3<br>
Trigger befor Output Doc
Code: Select all
$aSelected = explode('|', @@CurrentOutpatientTreatmentOrder);     
if (in_array("1", $aSelected)) //asumiendo que 1 es el valor de una opción en el checkgroup
     @@MarkOrder1 = "checked";
     @@MarkOrder1 = "";

if (in_array("2", $aSelected)) 
     @@MarkOrder2 = "checked";
     @@MarkOrder2 = "";

if (in_array("3", $aSelected)) 
     @@MarkOrder3 = "checked";
     @@MarkOrder3 = "";
What version of PM are you using? Your code will work in classic processes originally created before PM 2.5. The HTML editor introduced in PM 2.5 screws up the HTML code, so this:
Code: Select all
<input  type="checkbox" value="1" @#MarkOrder1> Option 1<br>
Code: Select all
<input  type="checkbox" value="1" MarkOrder1="MarkOrder1"> Option 1<br>
The solution is to place all the HTML code in a case variable and insert that case variable in the template for the Output Document.

If you have a BPMN process in PM 3, then the selected options in checkgroups are stored as an array (not a string separated by '|' like in classic processes), so you have to access them differently in the trigger.

First, create a checkgroup like this in your DynaForm:
servicesCheckgroupInDesigner.png (16.19 KiB) Viewed 2091 times
with the following list of options:
CheckgroupInOutputDoc.png (9.9 KiB) Viewed 2091 times
The HTML code for your Output Document template should look like this:
Code: Select all
<p>Services Required:<br />
Then, create a trigger to set the value of the @@servicesHtml case variable which is used in your template, like this:
Code: Select all
$formId ='81710538658c6bff6a3e8a7056075051'; //set to ID of DynaForm
$fieldId = "servicesRequired"; //set to ID of checkbox group

$aFields = PMFDynaFormFields($formId, @@APPLICATION, @%INDEX);
@@servicesHtml = '';

foreach ($aFields as $aField) {
	if ($aField->id == $fieldId) {
		foreach($aField->options as $aOpt) {
			$checked = '';
			if (isset($aField->value) and is_array($aField->value) and 
				in_array($aOpt->value, $aField->value)) {
				$checked = 'checked="checked"';
			$val = $aOpt->value;
			$label = $aOpt->label;
			@@servicesHtml .= "<input type=\"checkbox\" value=\"$val\" $checked>$label\n";
Set this trigger to fire before the Output Document step in your process.

This trigger uses the PMFDynaFormFields() function to get the list of options in the checkgroup. It places the value and label for each option in the HTML code for a checkbox and appends that code to the @@servicesHtml case variable which is used in the Output Document template.

When a case is run it will generate an Output Document file with the following checkgroup embedded in the document:
CheckgroupOptions.png (9.18 KiB) Viewed 2091 times
To try out this example, download and import the
(27.73 KiB) Downloaded 320 times

The one drawback of this approach is that it doesn't work with a checkgroup whose list of options is dynamically generated from a variable or an SQL query. For a dynamically generated list of options, the only solution is to add JavaScript to the DynaForm which saves the list of options when the DynaForm is submitted as a JSON string in a hidden control. Then decode this JSON string instead of using the PMFDynaFormFields() function to get the list of options.
Thanks amosbatto , I'm using PM3
Have tested and it works 100% on PDF , but Word won't display the Checkbox at all on my Mac.
It seems like it may be my version of word, or my word installation, as it works in word on other PC systems.
I'm using word for Mac, Version 15 (latest)
Unable to create workspace

I have the same issue. Any solution? Thanks alex[…]

Install in ubuntu

Dear All, In our dev environment we did an upgrad[…]

Get data from oracle database.

How to display all data in a table from oracle DB […]

Hello everyone, I have the same route case issue, […]