Skip to main content

Hello

Does anyone have a solution to the following scenario:

 

I have an activity that has a smartobject event that returns a boolean value. What I want to do is if the value is false i want to rerun the activity until it returns me true then go to next activity. 

I've tried putting a server event that checks the value and sets the Outcome datafield to the right Line, and then the Line checks if the outcome is right - but if the value is not right the process just ends in completed state. I've tried putting escalation but ofcourse it never fires because the activity completes (and im guessing, because theres no client events?)

 

I dont want client events because no users are required. 

 

The ideal solution would be to have the smartobject event, and if it returns false then escalate again after 10 secs until true, then move on.

 

Any ideas?

You can point a line back to the activity it comes out of.

So in this case I would have two lines coming out of your SmartObject event, and on each one put a line rule. One line if the SmartObject result was True, the other if it was False.  Then just point that false line back into itself and it'll keep going around and around until true.

 

But I would put a delay on the event to wait a few seconds or a minute between each run so it's not killing your server with an endless loop.

 

17200iB82853CDEF2A91CB.jpg


Thanks Victoria, I thought of that solution but I didnt want to kill the server - at the time I totally forgot about delaying the start of the activity.

This works perfectly


Janev... take a look to this post:

Ability to schedule Loops and Workflows in BlackPearl

http://community.k2.com/t5/K2-blackpearl/Ability-to-schedule-Loops-and-Workflows-in-BlackPearl/m-p/86451#M26656

 

Basically you create a View that List the Items to be Escalated.

Use the Windows Scheduler to trigger at a specific date/time an IE browser. I assume as k2admin account. who will have access to the Escalation View.

This can trigger a workflow that does what you need to do.

 

Hope this helps.

 

Dino.

 


Be very careful with polling scenarios. Be sure to use a start rule on the activity as those are asynchronous and should allow the process to save to the database and free the executing thread. And, be sure to use a long enough wait interval. The risk of not hitting an asynchronous event is that the process state will continue to grow, consuming memory and keeping the thread busy with that one instance instead of moving onto another instance that needs to do work.

 

Good luck!

 

S.


Reply