Customization
There are a number of extra steps that can be taken to improve the behaviour of the workflow. Below you will find some examples of such steps. One useful feature is to populate the customer fields using data we already know of the user currently logged-in.
Create a new trigger and call it CustomerData. Populate the trigger with the code shown in 1. And, assign the CustomerData trigger to the Before Dynaform step of the Submit Request task.
|
1 2 3 |
$userData = userInfo(@@USER_LOGGED); @@customerName = $userData['firstname'] . ' ' . $userData['lastname']; @@customerEmail = $userData['mail']; |
In most cases it is useful to assign a supervisor to the process so that he/she can have an overview of the status of individual jobs.
To assign a supervisor, click on the Supervisors button on the right-hand side. In the dialogue box, click on the green arrow next to Piet de Jong to assign him as supervisor of the process.
We also need to take care of the appropriate naming of the job instances of the process so that they are distinguishable from each other. This is achived through the creation of so-called Case Labels.
Open the properties of the Process Request task, and include the code in 2 in the Case Labels title.
|
1 |
@=requestTitle (@=USR_USERNAME - ObjectID: @=cadastralNumber) |
DataGeneration Form
Based on the content of 1, Create a new form, name it DataGeneration, and make sure all the fields are included. Most fields and variables already exist, the only new ones are formatedGeometry and submitDataset. Assign the new form to the Steps of the Generate Dataset task.
Controls and Variables for the DataGeneration form
| Web Control | Variable & ID | Datatype | Label | Options: key — label | Re-quired | Display Mode | ||
|---|---|---|---|---|---|---|---|---|
| title | t_DatasetGeneration | Dataset Generation | ||||||
| textbox | requestTitle | string | Request Title: | disabled | ||||
| textbox | customerName | string | Customer Name: | disabled | ||||
| textbox | customerEmail | string | Customer Email: | disabled | ||||
| datetime | requestDate | datetime | Request Date: | disabled | ||||
| dropdown | objectType | string | Object Type: | parcel ship public |
— — — |
Private Land Boat/Ship City Owned Land |
disabled | |
| dropdown | dataFormat | string | Data Format:: | pdf gml geojson kml ewkt |
— — — — — |
PDF GML GeoJSON KML Well-Known Text |
disabled | |
| textarea | formattedGeometry | string | Formatted Geometry: | |||||
| textarea | reviewComments | string | Review Comments: | True | ||||
| submit | submitDataset id & name |
Submit Dataset | ||||||
We now need to create a trigger to format the geometry value of the cadastral object according to the user requirements.
Create a new trigger and name it FormatGeometryOutput. Edit the trigger and add the code in 3. Use the Steps of the Generate Dataset task to assign the trigger to the Before Dynaform section of the task.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
/* database identifier */ $pg = '47586470856fe830965fe59023988130'; __MSG010__ $format = @@dataFormat; if ($format == 'pdf') { @@formattedGeometry = @@objectGeometry; } else { $format = "ST_As" . $format; $objectid = @@cadastralNumber; $result = executeQuery("SELECT $format(geom) AS geom " . "FROM enschede.spatialunit " . "WHERE spatialunit_id = '$objectid';", $pg); @@formattedGeometry = $result[1]['geom']; } |
This trigger again contains a piece of SQL code to generate the geometry value in the desired format. Based on the requested data format, one of the PostGIS ST_As### functions is used to do the work. To select the right function we append the value of the @@dataFormat variable to the ‘ST_As’ string and use that as the name of the function in the SQL code. Note that the UID used here should correspond to your own database connection.
The FormatGeometryOutput is also required for the certificates so it also needs to be executed for those cases. Repeat the process in Step 33 but this time add teh trigger to the Produce Certificate task.
Output Documents
The Generate Dataset and Produce Certificate tasks, will generate documents to be delivered to the client. Within ProcessMaker, this is realised by creating so-called Output Documents. We are going to create two types of output documents one for certificates and one for datasets.
To create such documents click on the Output Documents button select Create. Fill in the output document form as shown in 1. Once complete, click Save.
The actual content of this document is just the formatted geometry attribute of the cadastral object. To include this value in the document we only need to write the labels of the relevant fields and use them to produce the corresponding (required) values.
Now, click on the Open Editor button to assign the content to the document and include the content of 4. Select Courier New as the font type, and 3 (12pt) as the font size.
|
1 2 3 4 5 6 7 |
DATE: @=requestDate Cadastral Identifier: "@@cadastralNumber" Extent: @=objectBbox Coordinates: @=formattedGeometry |
Create another output document using 2 as a reference and call it Certificates.
The content of the Certificates output document is a little bit more elaborated and therefore we will specify it using plain HTML.
Click on the Open Editor button of the Certificates document, and then switch to plain editing by clicking on the HTML button in the toolbar. Replace the existing code with the content of 5. Save the document when you are done. After entering the HTML code click on Update to switch back WYSIWYG mode, to see how printed certificates will look like. The real values will be added in run-time.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <style> table { margin:0px; border: solid 1px #b8b8b8; font-size: 12pt; } .att { background-color: #e7e7e7; } </style> </head> <body> <br> @=requestDate <br><br> Dear Mr./Mrs. <span style="font-weight: bold;">@=customerName</span>, <br><br> After reviewing your request we have compiled the corresponding information on cadastral object [@=cadastralNumber], which you can find below. <br><br> <table style="border:solid 1px #b8b8b8;"><tbody> <tr> <td class="att"> Cadastral Identifier: </td> <td>@=cadastralNumber </td> </tr><tr> <td class="att"> Ownership: </td> <td style="border-top:solid 1px #b8b8b8;">@=naturalPerson@=nonNaturalPerson </td> </tr><tr> <td class="att"> Neighbourhood: </td> <td style="border-top:solid 1px #b8b8b8;">@=neighbourhood </td> </tr><tr> <td class="att"> Image URL: </td> <td style="padding:2px; border-top:solid 1px #b8b8b8;"> https://gip.itc.utwente.nl/services/parcels?@=wmsParams </td> </tr><tr> <td class="att"> Image: </td> <td style="padding:2px; border-top:solid 1px #b8b8b8;"> <img src="https://gip.itc.utwente.nl/services/parcels?@=wmsParams" width="300" height="300"/> </td> </tr><tr> <td class="att"> Coordinates: </td> <td style="padding:2px; border-top:solid 1px #b8b8b8;">@=formattedGeometry</td> </tr> </tbody></table> <br> Kind Regards, <br><br> CUSTOMER SERVICE <br><br> </body> </html> |
Feel free to adapt, modify, and/or improve the look and feel of the document. Be aware of the multiple process variables that are associated with the document. Like all other elements we have created for thr workflw to operate properly, each of the output documents has to be associated with its corresponding task, which is done using steps.
Use the Steps option of the Generate Dataset task to associate to it the Datasets output document. Repeat the process for the Produce Certificate task and the Certificates output document.
Process Instances (Cases)
To be able to interact with the process outside their specific assignments, user require specific permissions. This permissions will allow, for example, a member of the public who has submiited a request, to check on the status of his/her application.
It is now time to test the workflow and see the impact of the various actions that we have taken so-far in the implementation of the process. Navigate to the Home page and login as one of the members of the public and initiate a couple of jobs (cases) with different options to see if the workflow behaves as expected. Remember to use the proper login credentials as you progress through the workflow.
If the workflow does not behave as expected, or if any error message is generated, go back to the design page and check that particular part of the workflow. To see the values of process variables you can put the process in Debug mode. To do that, right-click on an empty area of the canvas and hit Edit Process, then tick the check box of the debug option.
One more thing still needs to be done, we need to create an Invoice document. This task will fall on you. Remember!!!, before implementing any changes it is good practice to export the process to have a working copy of the process, should anything go wrong later on.