Can i retrigger the workflow from the activity which has failed using wait for condition

ashwani_eshoppi
Kilo Expert

I have added a wait for condition in the workflow and checking a field value inside the script , this field is getting populated from another REST message call.

In wait for condition, i have made a query to the table which has this field.

Now since the field is getting populated asynch , and if the script executes in wait for condition , and it does not match , it remains at the same running stage, until the workflow is retrigerred.

Is there a way, to retrigger the same halted activity?

1 ACCEPTED SOLUTION

ashwani_eshoppi
Kilo Expert

Thanks for your responses.


I have implemented a solution which works fine.


Trigerred the event defined in wait for event activity from the scripted web services using the below code.


new Workflow.broadcastevent(context.sys_id,"event_name").



For workflow, events is identified only through broadcast events and not gs.eventqueue


Eariler i was trying to trigger an event through eventqueue, which though was showing in event logs, did not interacted with event of wait for event activity.


View solution in original post

11 REPLIES 11

Julian Hoch
ServiceNow Employee
ServiceNow Employee

Usually, the workflow rechecks the condition when a change is made on the record, so it's not needed to trigger the workflow explicitly.


If the condition refers to another record, it might be needed. Have a look at the business rule "SNC - Run parent workflows" which triggers the workflow for Task records on change of child records.


ashwani_eshoppi
Kilo Expert

Thanks for suggestion, will check this out.


ashwani_eshoppi
Kilo Expert

Tried using both wait for condition and wait for event, both activities keeps running, and does not restart.


Another thing , this workflow is defined in global table, hence i can't gliderecord and reuse code like in "SNC - Run parent workflows".



Any other way of passing the wait for condition activity.


Further , i don't need the workflow to be restarted with the previous tasks in line, instead should retrigger from the same activity.


What do you mean with "global table"?


And I don't get what you mean with "restarted with the previous tasks in line". Perhaps you can give an example or show a screenshot of your workflow?