Use your own approval engine with Oracle SAAS Applications

 

Summary

There are a lot of approval flows that come out-of-the-box with Oracle's SAAS applications. Just think of the AP Invoices or Purchase Order approval flows in Oracle ERP Cloud. These flows are implemented by Oracle development in Oracle BPM. Most of the times a user-friendly user interface is also delivered allowing users to customize the approval flows without having to write code. Because as soon as you write code you lose upgradeability.

But this user-friendliness comes at a cost: you do not have access to all the nice state-of-the-art features of Oracle BPM. Although you can implement 99% of your requirements using the delivered screens in an update-safe way, you might have a mandatory requirement that is not covered by what is available out-of-the-box.

This blog explains a way to externalize some approval processes allowing you to use an external business process engine such as Oracle Process Cloud (https://www.oracle.com/cloud/integration/process-cloud-service/) or some other tool and/or engine. You can use entirely custom approval logic including using your own machine learning algorithms created by your data scientists. The sky is really the limit. The good thing is that you will do this without jeopardizing the upgradeability of Oracle ERP Cloud.


General Approach

The general approach is simple. At a certain point in time you want to handover the approval processing to an external engine. You can do this by forwarding the approval request to a specific (technical) user of Oracle ERP Cloud (I will talk about Oracle ERP Cloud, but this applies to all Oracle Fusion SAAS services such as ERP, SCM, HCM and other cloud services).

The following steps are involved:

Create an Approval Group

You create an approval group in the "Manage Approval Groups" task.



You can add one or more users to your approval group. You create a group with one user if you want to do all the processing in the external engine or you can add several users to this group if you want to partly process in the external engine. I have created one group because I want to do all processing externally.

Change the Approval process

Now you need to change the approval process to route the approval request to the approval group you just created. I have changed the approval process used to approve purchase orders. You make this change in the "Manage Purchasing Document Approvals" task.


In my case I want to make sure the "Preapproval" stage is routed to my new approval group if no value is entered in one of my flexfields - but you can use whatever routing logic and conditions that make sense to you. Don't forget to deploy your changes.

Now the Purchase Order will be routed in the "Preapproval" stage to my new group. But nobody will be using the user interface of ERP Cloud to approve or reject the document. All that will be handled by my external process engine.

Pick up the approval request using a REST API

The approval request is now waiting. Your external process engine needs to pick it up and process it. Picking up the approval request is very simple because Oracle has made a REST API available to look at approval requests by allowing access to the task list (https://docs.oracle.com/en/cloud/saas/applications-common/21b/farca/op-bpm-api-4.0-tasks-get.html).

The call to retrieve the current list of approval requests is very simple. You can limit the list to include only the purchase order approval requests as follows:

https://<<YOUR-SERVER>>/bpm/api/4.0/tasks?keyword=Approve%20Purchase%20Order

This call will return the list of open purchase order approval requests. You can find the task id under the 'number' attribute - in this case '536283'.





You can find the purchase order id under the 'identificationKey' attribute - in this case '300000224616668'.

You will need these two numbers in the future.

Execute the approval logic

Now it's up to you. Control is handed over to your external business process engine. You can use the purchase order id to retrieve all details you need about this purchase order using the REST APIs

https://<<YOUR-SERVER>>/fscmRestApi/resources/11.13.18.05/draftPurchaseOrders/300000224616668?expand=all

If you are working on requisitions or AP invoices you need to use the correct REST APIs - but they are all available and easy to use.
At the end of your processing you need to decide to approve or reject the document or transaction. The logic is entirely up to you and there are really no limits.

Approve/Reject the approval request using a REST API

Now it is time to hand control back over to Oracle ERP Cloud. You just need to use the correct REST API to approve or reject the document. In order to do this you need to use the task id you retrieved earlier and the correct API

https://<<YOUR-SERVER>>/bpm/api/4.0/tasks/536283

Use this body to approve

Use this body to reject


So What?

So what have you now done? You have extended the approval logic of Oracle ERP Cloud using a tool of your choice without any limits to how you process the approval. You can use entirely custom approval logic including using your own machine learning algorithms created by your data scientists. The sky is really the limit. The good thing is that you have done this without jeopardizing the upgradeability of Oracle ERP Cloud. Pretty cool isn't it?


I hope this is helpful and good luck!


Alex.

I am not a spokesperson of Oracle and the information in this blog reflects my personal findings and opinions.

Comments

Popular posts from this blog

Create a complex multi-subject area analysis in Oracle Transactional Business Intelligence

Better Together: Oracle Cloud Applications APIs and Oracle API Gateway