- 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:59 AM
Hi Dominic,
I was facing similar Issue, I triggered workflow by calling it trough code from business rule.
for Your reference I am attaching this thread it may help you. Workflow got Struck.
I used this code , It was working fine. May be you need to modify this code depending where you are going to write.
(function executeRule(current, previous /*null when async*/) {
var wf= new Workflow();
var gr=new GlideRecord('sc_req_item');
if(gr.get(current.request_item)){
wf.runFlows(gr, update);
}
})(current, previous);
Thanks,
Nithin.