Reusing YAWL specifications as subworkflows (YAWL 4.0)
YAWL 4.0 features an integrated worklet editor that makes the work of a previous tutorial much easier. Our goal here is to use the worklet service to create a subworkflow that can be reused in many specifications. In order to demonstrate this, we will create two YAWL specifications. MainProcess.yawl is the specification for the workflow that will call the subworkflow. DisplayValue.yawl is the one that will be called. You can find the specs attached below. Let us now start step by step.
Upload the Worklet
Make sure that your YAWL editor is connected to a running YAWL engine. Open DisplayValue.yawl in your YAWL editor and store it as a worklet.
Add a Rule to the Main Workflow
Close this specification and open MainProcess.yawl. Then add a rule to this specification.
The rule type must be set to "Worklet Selection". The task must be set to "ShowValue". Note that the custom service in the decomposition of task "ShowValue" must be set to the worklet service (this is already the case in our specification).
The condition is set to the constant "true" because we always want to use the same worklet.
In the "Actions" section we have to select the action "select" ...
and choose our worklet DisplayValue as the target.
Now the dialogue should look like this.
We click "Add & Close" and hopefully get the following message of success.
Export the Rule Set
This step is optional. Exporting the ruleset allows you to reuse it later in another YAWL engine. There is a button for exporting the rule set.
The following selection dialogue appears. Note that the rule set is associated to the specification and its version.
Store the file MainProcess.xrs somewhere. It will look similar to this.
The main process is identified by its name, its version, and its unique identifier. The worklet is identified by its unique identifier only.
Deploy the Workflow
Next we will upload MainProcess.yawl using the button in the editor.
Now we are ready to test if it works. We start a case for MainProcess and assign the workitem ShowValue to some existing user. When the user views the work item it should look like this:
It is important that it says "Display value". If it says "ShowValue" it is not the worklet but the default behaviour of the MainProcess that is displayed.