The CreatorCon Call for Content is officially open! Get started here.

Need help with Wait for Condition Business Rule

alhicks
Tera Guru

We have a workflow on the Task table, creating a project/task with the parent on the prj an RITM.  When the Proj Task closes, we need to force the w/flow to update for the wait for condition to continue.

I'm trying the business rule that I've found on the forum but I'm needing to query the RITM on the project.parent from the prj task table.

function forceWFupdate(){

var wf = new Workflow();

var pm = new GlideRecord('pm_request');

if (pm.get(current)) //or current.parent or current.change_request if you want it to update the parent's wf

wf.runFlows(pm,'update');

}

 

Here's a prj with the RITM as the parent.  The prj task is closed but the wait for will not advance until we update the RITM.

find_real_file.png

 

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

On which table are you running the workflow?

you can write a BR on Project task table as below

forceWFupdate();

function forceWFupdate(){

var pm = new GlideRecord('pm_request');

if (pm.get(current.parent)) //or current.parent or current.change_request if you want it to update the parent's wf

{

pm.work_notes = current.number+' has been closed';

pm.update();

}

 

var ritm = new GlideRecord('sc_req_item');

if (ritm.get(current.parent.parent)) //or current.parent or current.change_request if you want it to update the parent's wf

{

ritm.work_notes = current.number+' has been closed';

ritm.update();

}

}

 

 


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

2 REPLIES 2

SanjivMeher
Kilo Patron
Kilo Patron

On which table are you running the workflow?

you can write a BR on Project task table as below

forceWFupdate();

function forceWFupdate(){

var pm = new GlideRecord('pm_request');

if (pm.get(current.parent)) //or current.parent or current.change_request if you want it to update the parent's wf

{

pm.work_notes = current.number+' has been closed';

pm.update();

}

 

var ritm = new GlideRecord('sc_req_item');

if (ritm.get(current.parent.parent)) //or current.parent or current.change_request if you want it to update the parent's wf

{

ritm.work_notes = current.number+' has been closed';

ritm.update();

}

}

 

 


Please mark this response as correct or helpful if it assisted you with your question.

Thank you Sanjivmeher,  that worked...:))  Of course, I had a typo on the project table in my post, but I did have the correct table in the br..:)