- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 07:50 AM
Hello ServiceNow Gurus,
I am facing a challenge pertaining to workflows more specifically the "Wait for Condition" utility.
In this case, the workflow needs to wait until the underlying PtO(Permit to Operate) record has been approved. I have created a "Ptb Approval Flag(u_pto_approved)" True or False field on the underlying table, that checks if the associated PtB record is approved or not. If the associated PtB record is approved a BR is triggered to update the Approval Flag field to True.
My intention of using "Wait for Condition" is to wait until once the flag has been checked, and then proceed forward with the workflow. As it stands, the once the PtB record is approved, the Approval flag updates to True but the workflow stops there and doesn't proceed forward. However, I did notice if I update any other random fields on the form, and hit save, the workflow then only proceeds forward.
Is there a way I can automate this? Such that once the PtB Approval Flag is checked by the BR, the workflow proceeds forward without any hinderance? Would I need to add in additional script to my BR such that once Approval Flag is true -> trigger back the workflow? If so, how would that additional piece of script look like?
Much thanks for your insight on this matter.
-Dominic
Solved! Go to Solution.
- Labels:
-
Enterprise Release Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 10:10 AM
Ohh, are you setting the PtB Approval flag from a display business rule?
That makes sense, as the value is just shown on the form and not really saved at the server side. In fact, since the server side value is still "false" for this field, even if we trigger the workflow from display business rule, it won't work.
What I'd suggest is to write a business rule on PtB Approval records. And as soon as it is approved, update the parent rm_release record. That would trigger the workflow.
-Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 09:43 AM
The workflow is running on the Release(rm_release) table.
The u_ptb_approved field exist on the Release(rm_release) table as well.
-Dominic

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 09:42 AM
Hi Dominic,
It seems that the wait for condition was not checked when the u_pto_approved was checked to true. And as you've already clarified that you're not using setWorkflow(false) in the BR that sets this field to true, we'd have to nudge the workflow to force it to check this condition.
Could you add this line in your BR that updates u_pto_approved field, replace gr with reference to rm_release table.
new Workflow().broadcastEventToCurrentsContexts(gr, 'update', null);
-Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 10:04 AM
Thanks Mandar,
I think that is the route we would need to take. We would need to trigger the workflow from the BR that is updating the "PtB Approval Flag".
My question at this point would be: Will the script "new Workflow().broadcastEventToCurrentsContexts(rm_release, 'update', null);" work for Display BRs? Or would need to be associated to Before or After or Async? In order to working properly.
Thanks
Mandar,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 10:10 AM
Ohh, are you setting the PtB Approval flag from a display business rule?
That makes sense, as the value is just shown on the form and not really saved at the server side. In fact, since the server side value is still "false" for this field, even if we trigger the workflow from display business rule, it won't work.
What I'd suggest is to write a business rule on PtB Approval records. And as soon as it is approved, update the parent rm_release record. That would trigger the workflow.
-Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2017 11:35 AM
Thank you very very much Mandar!
That direction solved my issue. I wrote an After BR from the PtB table that updates the Release once the PtB has been approved.
Going this route, I didn't have add any additional workflow re-trigger statements on BR, and the workflow is working as intended.
Much thanks.
-Dominic