Skip to Main Content
Feature Request FR-4465
Product Area Workflow
Status CLOSED

1 Voters

Additional Feature to Workflow Wait Activity

emmanueljosephjean Public
· May 15 2025

Idea Summary
Last week, I was given a task to create a workflow for procurement. I thought it would be a standard workflow but then I faced an issue. See, in this workflow, the process is as follows:

1. Requisition (Choose whatever items you want for the requisition)

2. Send this requisition for approval(Workflow Starts).

3. Then if it is approved, our requisition's status will be changed to ‘Approved’.

4. The next process is consolidated requisition. Now what happens is a user comes in and selects from a list of approved requisitions, and then sends those consolidated requisitions for approval. Now there is the problem.

See, this user can select any combination of requisitions and can send that for approval, so the real problem here is the ‘send that for approval part’. Since this workflow already began, i want, only after the user clicks send for approval,  the workflow to flow to the human task for consolidated requisition approval.  So what we have to do is basically ‘wait’ for the user to take our requisition put in a consolidated requisition, and then send that for approval. I tried using the wait activity for this, but unfortunately, maybe i am dumb, but it only returns the interval of something, which is not what i want.

What i want is for the wait activity to ‘wait’ until a column's value changes, for eg. to ‘Approval Pending’. Then after that the workflow should continue. So the whole workflow should wait till that approval pending happens for that column. I tried many things, but i finally got a solution to work, its a huge workaround, so hopefully you can find another solution(I explained my solution and the preferred solution in the Preferred Solution down below).

Use Case
 

It could be used for my use case, and other use cases which i can't think of right now. Um maybe my fellow developers could help.

Preferred Solution

Ok so, my solution that I used is this:

1. Create a human task called ‘Wait’
2. Make every single user a active participant for this human task.
3. After a requisition has been approved it will go here.
4. It will wait how long as we want, as human tasks don't expire unless we set it.
5. On action executed for this wait task, on create, i will insert the task_id into the requisition table for that particular requisition.
6. When a user selects the requisitions needed for the consolidated requisitions, and clicks the send for approval button our wait activity will be  “Approved”, using the approve procedure and the task_id from the table for that particular requisition.  
7. And thus our workflow will continue from where it left off. 

This solution works(i am pretty sure) and has no problems(i am pretty sure). But this is my preferred solution:

In the wait activity itself, instead of only using intervals, make it also work with true/false conditions. Like it checks something in a table and until it returns true, it will wait, for an indefinite amount of time rechecking and rechecking. This would be pretty nice instead of the roundabout way I did. So yeah, thanks for listening, also if any other solution already exists which is easier, please provide below. 

Thanks
Emmanuel

This is a great idea! You can already achieve this in APEX today with a slightly different approach.

Comments

Comments

  • mos OP 5 weeks ago

    i dont get it. it is indeed possible to create a wait activity and set it to check if a condition returns true.

  • emmanueljosephjean OP 5 weeks ago

    @mos Yeah but thing is that keeps rechecking and rechecking, and I saw that somewhere that it creates lot of activity instances or something like that, and my workflow could ‘wait’ for weeks (max), so this rechecking forever seems kinda bad I think. Like it should be how human tasks can wait for weeks and still continue from where it left off when someone approves it. I want something like that.

  • ralf.mueller APEX Team OP 2 weeks ago

    Hi @emmanueljosephjean , 

    this seems a bad design, essentially you ask us to poll for data in the Wait activity. This is not what the wait activity is intended for. You can achieve the behavior in a much more elegant way by using Oracle Database Continous Query Notification (CQN) with a bit of PL/SQL code to unblock a Wait activity in the workflow (by using APEX_WORKFLOW.CONTINUE_ACTIVITY API). 

    We will add some more Event driven features to APEX Workflow in the future.

  • steve.muench APEX Team OP 4 days ago

    Another possibility is to use Ralf's suggested CONTINUE_ACTIVITY in a database trigger that conditionalizes the call with the check for :NEW and :OLD fields to ascertain if the conditions are right to continue the workflow. You can lookup the workflow id from the APEX_WORKFLOWS view using the combination of the WORKFLOW_DEF_STATIC_ID to identify which workflow definition and the DETAIL_PK using the current record's primary key. Then in an autonomous transaction you can call APEX_WORKFLOWS.CONTINUE_ACTIVITY() from the trigger. I've used this technique successfully in various applications I've built since APEX workflow debuted.