Scripting a delay in a wait-for condition

tahnalos
Kilo Sage

Hello all.

I have a wait for condition in my workflow that is supposed to look at a field and run if the field is a particular value.   That field is being set by a UI action.

The problem I am having is that the wait for condition does not trigger when the UI action is pressed.   If I press the UI action again, then it runs.   I am strongly suspecting that the issue involves some sort of delay when the UI action is run so I would like to have the wait for condition have a delay built in before evaluating the field.

Ideas on how I can accomplish this?

Thanks

7 REPLIES 7

Chuck Tomasi
Tera Patron

Can you share with us the details of your UI action and waitfor condition?


Workflow Wait For Condition:


if (current.u_reject_reason == 'reschedule')


  answer = true;


else


  answer = false;



UI Action:


resubmitSchedule();


action.setRedirectURL(current);



function resubmitSchedule ()


{


  current.u_reject_reason = 'reschedule';


  current.update ();


}



I'm thinking a delay needs to be coded either after the update on the UI Action or before the if on the Workflow Wait For Condition.   If I press the UI Action again, it works.


That's interesting. Have you tried using the good old field chooser instead of a script for the Waitfor condition? Example below:


find_real_file.png



The current.update() in your UI action kicks off the workflow updater and business rules on that record. They should be happening in the right order.


I actually did.   Same result.   In fact, it was actually in its non-script form before I converted to a script for debugging.