Actions of Nodes

Actions of Nodes

Actions define the operations to be performed in each node, internally. Basically action defines the operation of a node. You can develop code for the operation of each node using functions, control statements, logical statements, and so on.

Create Actions

For example, we need to send a Notification if Holiday Request is rejected.

1. To open the Process Action Editor screen, click the following buttons:

Administration -> Edit Process Types -> Edit button for Request Holiday Process -> Edit button for RejectNotification node -> Edit Node Actions button.

The Process Action Editor screen will open:

To create a SendNotificationMail action you can either write the plain Groovy code (using Variables and Actions from the drop-down list as a hint) or you can use  button to add Variables and Actions automatically.

Select SendNotificationMail from the drop-down list and click  button.

Action Call Parameters page will open in a new window; Fill in the necessary fields and click Apply button:


Manually adjust the code:

and click Apply button.

Important: Return Statement!


According to the node type you should pay attention to the nodes actions. If the node is manual (type is 'Wait') then you don't need to trigger any transition and specify 'return' statement. The body of 'Wait' node is executed after transition definition (the transition is defined manually by the user). If the 'return' statement is specified in manual node it is ignored by process execution engine.

If node type is automatic (one from 'Activity', 'Fork', 'AndJoin', 'OrJoin') then you need to specify the 'return' statement that triggers the next transition.

Return statement has the following syntax:




If there is no 'return' statement for automatic node then the next node(nodes) cannot be activated.

From the version of Grailsflow-1.0.x when 'action' closure contains plain Groovy code then return statement can hold functions, expressions, etc.
The evaluated value is transfered to String type and used for transition definition.

Note: The Edit Node Action button is used both for create and edit actions. Once you create process, add process variables, create process nodes, add transitions, and create actions for nodes, click Save Process Type button to save the process. The process definition is saved on the server to file Process.groovy.

You can view the process definition file saved on server, using Show Source Code button.

You can reload definition that you currently edit form file Process.groovy by pressing Reload Process from File button.

To view the process in pictorial or graphical representation, click Show Graphical Process button.

Export as HTML button will create HTML that describes the process. It's something like report; you can view this HTML to get the common information about the process. A File Download window appears. Click Open or Save. A zipped folder appears. Open the zipped folder and open the html file.