Getting a process to wait for work to be done via web services

Getting a process to wait for work to be done via web services

I might be going about this the wrong way, but it feels like I'm so very close.

I have a very simple process (though I will have more):

Start -> WorkStart [Automatic Activity] -> WorkComplete [Wait] -> End

In the WorkStart automatic activity, I queue up a bunch of work for an agent to come in and complete using web services to both fetch work and indicate the work is complete.

When all the work is complete, I want the web service to say "yes, this is all done - you can now continue the process".

My detection works, the only problem is that whether WorkComplete is a Human Activity or a Wait, I can't really call CloseWorkComplete because it takes an ActivityId, and I don't actually have that ActivityId.

I can find out WorkStart's ActivityId, but because WorkComplete isn't actually "doing" anything, I don't have its ActivityId in order to close it. (I tried using WorkStart's ActivityId, but of course, it just comes up with a "Server was unable to process request. ---> Activity 'WorkStart' (#465) cannot be closed.")

(And I don't think guessing the number is safe, even though it's usually WorkStart.ActvityId + 1 :) )

I can't see anything in the System or BPT API which would give me the Id of the next Activity.

Am I going about this wrong or missing something?

Kind regards,

-- Ritchie Annand
This is doable with other BPMN-type systems in part because the activities are often in an 'incoming' and 'outgoing' state, accessible with the same identifier.

Maybe this will work in OutSystems:

A HumanActivity:
* Add an On Ready
* The queuing up happens in the On Ready
* I've read that the ActivityId is accessible and valid in the On Ready
* The "work complete" just closes the HumanActivity

I do wish that there was something halfway between Automatic Activity and Human Activity ("External Activity"? "Asynchronous Activity"?) that has the waiting of the Human Activity but none of the user assignment or due dates... but that might be a feature request for another time :)

-- Ritchie Annand
Fingers crossed...
Just dropping a quick note to note that this appears to work. This is good; that means that you can have agents "poll" work from the system (via web service or what have you) and have the process followed.