Chapter 7: Changing the Process Depending on the Situation

Let’s add a function to the workflow app that changes the next process depending on the situation. You can create a more complex workflow app by manually selecting the next step or changing the step depending on the value of a data item.

Chapter 7 explains how to select the next step in a Human Task and how to branch the flow depending on the value of the entered data item.

Additional Supervisor Swimlane

In the app we created in the previous chapter, only employees of the “10 Management Department” organization, who are the operators for the Management Department swimlane, can read the business trip applications. Here, we will also allow the applicant’s superior to review the application and choose whether to approve or reject the business trip.

Now, let’s edit the app again. Open the app details page from the app settings page and launch the modeller with the [Edit] button.

First, change the Workflow Diagram. Currently, there are only two swimlanes, “Applicant” and “Management Dept.”, but add a new “Supervisor” swimlane to them.

  1. Select the swimlane from the palette at the top of the screen and place the new swimlane between the “Applicant” swimlane and the “Management Dept.” swimlane. The object placement will be adjusted automatically
  2. After adding the swimlane, open the settings dialog and change the name to “Supervisor”
  3. Add a Human Task to the “Supervisor” swimlane and change the name to “Approval”
  4. Once the “Approval” task has been added, draw a flow like “Application” → “Approval” and “Approval” → “Confirmation”

You can redraw a flow by dragging and dropping the tip or base of the flow. If you have an unnecessary flow, as explained in Chapter 4, “What to do if you make a mistake,” you can delete it by selecting the flow and using the trash can icon that appears.

Next, add an End Event to the “Supervisor” swimlane and draw a flow from the “Approval” task.

It should look like the image above.

By adding a flow, we were able to branch the destination of the token depending on whether the supervisor approves or rejects the application. “Approve” and “Reject” can be set as button labels that are displayed at the bottom of the Approval task processing form, and can be selected when processing the task. They will not be displayed automatically when the flow is added, so let’s set the button labels.

Setting the Approve/Reject Button Labels

Now, let’s set the display name for each button. Open the settings screen for the Approval task. In the [Split] tab, you will see a setting item for the button label.

Leave the Split Type as “The token moves to the Destination that a user selects. (The number of buttons corresponds with the number of destinations.)”, set the Button Label of the Destination Node [3: Confirmation] to “Approve” and [5: End Event] to “Reject”. Now, when the supervisor processes the Approve task, clicking the “Approve” button will cause the token to transition to the Confirmation task, and clicking the “Reject” button will cause the token to transition to the End Event in the Supervisor swimlane.

Setting a Supervisor to be the Processor

If you set the processor to be the applicant’s manager, you must design the system so that the processor in charge of the Approval task can be changed to suit the applicant.

The person in charge of the Approval task can be automatically specified by using organizational data. In Chapter 3, when you registered users in bulk, you set which organization each user belongs to and which users have the role of “Leader” in their organizations. By using this, you can express the supervisor of the business trip applicant as a user with the role of “Leader” who belongs to the same organization as the processor of Applicant swimlane.

Therefore, in the Supervisor swimlane settings screen, set the processor for the Supervisor swimlane to “Swimlane”, “Applicant”, “Member in the SAME organization with a user who operated tasks in the swimlane”, and “Position: Leader”.

You can add and set job titles as you wish to indicate roles within an organization (department). When you first start using the Workflow platform, the “Leader” role is pre-defined.

This will automatically determine who will be in charge of the Approval task based on the organization to which the applicant belongs and the roles set for the members. For example, in the structure of the organization for this tutorial, the supervisor of Canary is Sumatra and the supervisor of Oahu is Galapagos. So what about the leaders of the organizations, Sumatra and Galapagos? Their applications will be assigned to themselves.

Now save and release the app.

For example, if Canary submits a business trip request and receives an Approval task on the account of their supervisor, Sumatra, the following page will appear. Now try clicking the newly created “Reject” button.

The token proceeded to the End Event in the Supervisor swimlane, and the process ended.

In this way, you can change the destination node of a token by using the options. This is one implementation of branching.

In reality, if the supervisor rejects the application, it would be better to send it back to the applicant. However, for the sake of simplicity, we’ve decided to end the process when the supervisor rejects the application.

Adding the President Swimlane

Finally, we will make it so that business trip requests exceeding $5,000 require the president’s approval. We will also be making changes to the app, so please open the edit screen.

Editing the Workflow Diagram

First, change the workflow diagram as follows. Add a new “President” swimlane and make major changes to the “Approval” task and beyond. Let’s take a closer look at the steps.

First, add a “President” swimlane. Place the new swimlane between the “Management Dept.” and “Supervisor” swimlanes. Then change the name of the added swimlane to “President”. Also, add the “Review” task to the President swimlane.

The green diamond-shaped objects with the words “Branch” and “Merge” written on them in the diagram above are called gateways. They control the branching and merging of flows. Gateways are also included in the palette.

Clicking the ▼ mark in the lower right corner of the gateway diamond in the palette will expand the Gateway list*. By selecting an icon from here, you can add various gateways to the workflow diagram. The following two types of gateways will be used this time.

* In the Basic Edition, the unavailable icons [OR-Split Gateway], [AND-Split Gateway], [OR-Join Gateway] and [AND-Join Gateway] are not displayed.

XOR-Split Gateway
(Exclusive Gateway)
Of multiple flows, the system will proceed to the first one that satisfies the conditions.
XOR-Merge GatewayExclusive (XOR) Gateway combines multiple separate flows into one.

Place the [XOR-Split Gateway] in the President swimlane and the XOR-Merge Gateway in the Management Dept. swimlane. The gateways you just placed do not have a name, so open the settings screen like other objects and set the names to “Branch” and “Merge” respectively.

All the icons should be in order like this.

All that’s left to do now is redraw the flow. When doing this, be careful not to move the flow extending from the Approval task in the Supervisor swimlane. The “Reject” and “Approve” flows have the branching conditions you set up earlier. If you delete or reattach the base of the flow (on the “Approval” task side), the settings will be deleted and you will have to set them up again. In particular, do not delete the “Approve” flow and then reattach it, but rather drag and drop the end of the flow to reattach it.

Keeping the above in mind, and draw a flow according to the following diagram.

After redrawing all the flows, check whether the names of the flows extending from the Approval task are still “Reject” and “Approve”. If you delete the flow once or remove the root from the Approval task, the branching conditions will be deleted and “Approve” and “Reject” will disappear. If this has happened, please set the button labels again.

This time, in order to simplify the process, we have set up a workflow where the president only reviews. However, there could also be a workflow where the president decides whether to approve or reject. The workflow would be as follows, with the same setup as the ‘Approval’ task in the ‘Supervisor’ swimlane.

If you only want to report to the president, you could arrange the Workflow App with an automation that sends emails with the details (in Chapter 8, we will explain how to send emails automatically in the middle of a workflow.)

Setting Branching Conditions Based on Amount

Next, configure the newly installed branch. Open the Split settings screen of the Exclusive (XOR) Gateway. In the Destination Node section, you can set the destination of the token for each condition.

ConditionDestination
Travel expenses are over $5,000“Review” task in the President swimlane
Everything else“Merge” gateway in the Management Department swimlane

If you can set it up like this, it looks like you will be able to achieve the desired behavior. Two conditions and a “Default Flow” are provided from the start, so let’s edit these. The Default Flow is the flow that is selected when none of the transition conditions are met. In other words, all you need to do is set the condition “Amount is greater than 5,000” and the Default Flow. The Default Flow will cater for everything else, as indicated in the table above.

The default flow is indicated by a diagonal line on the flow.

This time, one condition + default flow is enough, so delete the condition where the destination node is “Merge” and keep the Default Flow. Next, the destination of the Default flow should be “Merge”. This completes the branching settings.

Among the conditions, the destination is set as the Confirmation task, but the condition expression is “Always move to Destination”. You must change this to transition if the amount is over $5,000.

Click the pencil mark to open the details window, then enter the following:

  • Enter the condition name as “Condition 1”
  • Select “Move if conditions are met”, “Amount”, and “is greater than”, and enter “5000”

If the value of the data item “Amount” is greater than 5000, meaning that the travel expenses are over $5,000, the token will proceed to the Confirmation task in the President swimlane. This will allow you to control the token movement as shown in the table above.

Please check if the Split properties are like this. There is no particular setting for the “Merge” Join Gateway. This completes the workflow diagram!

Set the President as the Operator

Once you have finished editing the workflow diagram, the next step is to set the person in charge of processing.

In the President swimlane settings screen, change the Operator to Organization, 00 (company name), Members who belong to this and Position: Leader. Organization [00 (company name)] is the top-level organization, right? As the leader, you are the President. In this tutorial, we will set you as the leader of the organization [00 (company name)].

Now, save and release the app and let’s have an employee submit a high-value application for over $5,000. First, just like before, an Approval task will be sent to the applicant’s direct supervisor. Once the supervisor approves it, a Review task will be sent to your account, as the President.

Did the business trip request app you created work properly?

After you created the app, it automatically designated the direct supervisor and decided whether to get confirmation from the president. And all logs of when, who, and which tasks were processed can be checked later.

chevron_forwardChapter 8: Automated Processing in the Middle of a Workflow

chevron_backwardChapter 6: Working with Data in Various Formats

Scroll to Top

Discover more from Questetra Support

Subscribe now to keep reading and get access to the full archive.

Continue reading