Intrexx 5.0 enables you to define your own conditions in the scripting language Groovy. In this workshop we will explain how to use this in combination with request values.

In a classical approval workflow scenario the approval shall be granted via button click. Two “Save” buttons have been placed in the sample application. One button takes care about the approval and the other button saves the current status. The approval button gets an additional request parameter called rq_customMyParam with the text value approved.



In the process we would like to react to this parameter with a Groovy condition. In order to use Groovy conditions please enable the developer tools first.

The entry point of the process is the data group event-handler for the insert or change event of the data record. The following condition is no standard condition but a Groovy condition. Depending on the result of the Groovy condition two varying actions can be undertaken. If the approval has been released the IF-clause returns a value called requestApproved and otherwise the ELSE-clause returns the value requestNotApproved.

Next two fitting actions will be attached to the connection IDs.

Sample code:

def strApproved = g_request.get('rq_customMyParam')

if("approved" == strApproved)
	return requestApproved

return requestNotApproved

In the example two connection IDs are defined. Please note that only names contain small letters and no Groovy keywords such as true or false are permitted.

Next the approval data-field is set to true by a data group action. To make sure that the action will only be undertaken if the request has been approved the Groovy condition checks on the connection ID.


Furthermore all connection IDs defined in the Groovy condition must be used in the process in order to avoid errors during the process execution.

In our example the process simply ends if the request has not been approved.

This allows you to react to request values and therefore to design processes in a more complex way. Using even calculations in conditions would be possible.

Note:
In a Groovy condition a indefinite number of return values can be defined and used as connection IDs afterwards. Here another example:

def strApproval = g_request.get('rq_customMyParam')

if(strApproval == "approved")
	return requestApproved
else if(strApproval == "pending")
	return requestPending
else if(strApproval == "postponed")
	return requestPostponed

return requestNotProcessed

or:

def strApproval = g_request.get('rq_customMyParam')

if(strApproval == "approved")
	return requestApproved
else if(strApproval == "In Process")
	return [requestInProcess, sendMailInProcess]

return requestNotProcessed

The outputs will be processed in the same order as listed in the code [requestInProcess, sendMailInProcess]


United Planet
Intrexx Application Store Press Downloads
English