Keeping the UI and Human Activity State in Sync
Question

Good morning,

Part of our application is for users to request approval for various types of documentation that they create.  The BPT process is quite complex.  There is the "main" process that guides the approval flow, and a point there are child processes that are called that create the Human Activities (that's all they are responsible for, sending the HA to 2 people and wait for one of them to complete the task).

It is important to understand that our application data is not held within Outsystems entities, we use our own API to CRUD our data in an on-premise DB.  We do however use Outsystems data to control our workflows so that we can use Human Activities to control the approval process more easily.

So the User clicks the "Request Approval" button whose action starts the process, part of which is to send an HA to the user configured to perform the approval (It has to go to specific user rather than a group).  This action also calls the API to update the status of the documentation to "Pending Approval"  The UI gets refreshed at the end of that action to show the appropriate buttons. With me so far?

Recently a change was requested that the same user can both "request approval" and "approve" their own document. What I have found is that it is very easy for the UI, DB and BPT control data to get out of sync. A user can click "Request Approval", wait for the UI to update and present them with the "Approve" button and click it before the Human Activity has been served to them due to the asynchronous manner in which a Process is started. The result is that the Human Activity is waiting for an activity that has already been completed.

What are peoples thoughts around this? My immediate fix has been to add a delay into the "Request Approval" action that waits for the HA to be served before refreshing the UI. This works, but my surprise is that this can 20 seconds to happen! The process is also responsible for sending the emails to the approval users notifying them. Could it be having a process calling a child process to serve the HA and wait for it to be done is a bad idea?

Thanks in advance.

Hi Martin,

It seems you are processing frequent server action in a single server call. commit the transaction once the human activity is completed by the user. check in BPT, you are correctly ending/terminating the process once the human activity is completed. Hope above might help you..

Thanks, Aadhavan S

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.