Skip to Content
Technical Articles

Flexible Workflow: Custom Flexible Scenario – Part 3

Context

In Part 1 & 2 of the blog posts, we discussed about how to create a custom flexible scenario.Also, we used runtime classes to perform necessary operations based on approval or rejection.

Adding the links here, in case a recap is needed. Part-1, Part-2 .

Now, what if we need multi level approvals ? Or is it possible to configure these workflows without runtime classes.

 

Solution

In this blog post we will focus on an alternative to perform the necessary operations based on approval/rejection without using runtime classes, and also perform multi level approvals.

 

In the BO or custom class that you are using( I used a custom BO for my workflow), create a  method and write the necessary code needed. (This is part of workflow basics, I do not want to elaborate it here).

You can comment the code in runtime class which we created in part 2 of the blog post. We wont need them.

As mentioned in part 1, you already have a user decision created. Now for next step, create another activity.

Workflow%20Activity

Workflow Activity

 

Use the method created in BO or class in your activity, and setup the activity as background job.

 

Save and activate your workflow.

 

Now go to your Workflow App Tile in Fiori. Add a new workflow. Enter the description, start conditions and go to steps.

In steps, Select Approve Contract as the step, enter text as Approval Level 1 and save it.

Add another step. Enter text as Approval Level 2, select approve contract and save it.

 

Next, create another step ‘Activate contract’ & now select the type activate contract, which we created in this blog post as an alternative to runtime class method. Save the step.

2%20level%20approval%20scenario

2 Level Approval Scenario

 

Now we have 2 level workflow. If both the levels are approved, then the contract will be activated. With this scenario we can achieve ‘N’ levels of approval.

 

Note: We can also have more user decisions with specific texts like below, instead of having one generic user decision like in the earlier step. This helps us to provide the text description for the step to differentiate the level of approval. (We will use the same task, only creating multiple entries in the activities tab).

3%20Level%20Approval%20scenario

3 Level Approval scenario

 

Now create a contract, and test the approval scenario for multi-level approvals.

 

Conclusion

This custom scenario provides us the flexibility of designing multi-level approval in flexible workflows, something which standard flexible workflow scenarios do not provide. In the final blog post of this series(Part-4), I will provide insights on how to create a custom CDS Value help for start conditions.

 

Thank you 🙂

Be the first to leave a comment
You must be Logged on to comment or reply to a post.