Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Business Rule condition not working

leachy23
Kilo Expert

Happy Monday all, 

Im trying to get a business rule to trigger when a 'Resolve' UI Action is clicked on a 'parent' ticket within a scoped app, but for some reason it never triggers.

my condition is current.state.changesTo(6)

Its an after business rule (I have tried before) . 

the BR itself is 

function closeRelatedTasks(me) {
var task = new GlideRecord("x_insoa_investec_a_table_caa");
task.addQuery("parent", '=', me.sys_id);
task.query();
while (task.next()) {


gs.print("Task " + task.number + ' closed based on closure of task ' + me.number);
task.state.setValue(6);
task.close_notes.setValue("Resolved by closure of Parent");
task.update();
}


this.closeIncident(me);
}

All help is appreciated!

1 ACCEPTED SOLUTION

leachy23
Kilo Expert

It was a mistake in the the code, I replaced 

gs.info("case " + lend.number + ' closed based on closure of case ' + me.number);

with 

gs.info("case " + lend.number + ' closed based on closure of case ' + current.number);

 

and it all worked fine! Thanks for the replies all

View solution in original post

11 REPLIES 11

just a hunch, is client callable check box set to "yes"

leachy23
Kilo Expert

It was a mistake in the the code, I replaced 

gs.info("case " + lend.number + ' closed based on closure of case ' + me.number);

with 

gs.info("case " + lend.number + ' closed based on closure of case ' + current.number);

 

and it all worked fine! Thanks for the replies all