Urgent:Business rule to check change task close code value

soumya17
Tera Contributor

Hi,

I am writing after business rule on change request table to check close code value of change task. 

My requirement is: if close code of changetask is successful/successful with issues -> change req state should move to review

if close code of changetask is unsuccessful ->change request state should be in implement only. 

Below is my BR. Please correct me if i am doing anything wrong here..

 

Thanks

Soumya

8 REPLIES 8

Brad Bowman
Kilo Patron
Kilo Patron

You're missing a few standard GlideRecord lines after var gr to locate and return the change task record before you get any values from it...

var gr = new GlideRecord('change_task');
gr.addQuery('change_request', current.sys_id);
gr.addQuery('active', false);
gr.query();
while (gr.next()) {
    var cc = ........

Also, since you are running the BR after Update, you need a current.update(); line in the if and else.  Another approach that would work in this case is to change the BR to run before Update, then do not include the current.update lines.  Also in this case since the BR only triggers when the Change Request State changes to Implement, you don't need to set the current state to Implement, so as written your if block would be empty.

Thankyou for ur response. I tried but it didnt work

even if close code is unsuccessful  change req is moving to review..

Any other way to achieve this.

You didn't mentioned "current.state = " in unscceussful code

if i do also no difference..its not working