After adding approvers manually for ritm and, after approving the record RITM state/stage to update

harish mandhula
Tera Contributor


After adding approvers manually for RITM,  and after approving the approval record the RITM state/stage should be updated.

By using flow designer it's not working, please help me in creating the BR for this requirement.

below was the script 
BR on RITM Table

var app = new GlideRecord('sysapproval_approver');
    app.addQuery('document_id',current.sys_id);
    app.addQuery('state','approved');
    app.query();
    while(app.next()){
    gs.addInfoMessage('test');
        current.state="2";
        current.stage="fulfillment";
        current.update();
}
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@harish mandhula 

what's the trigger for your business rule?

your business rule should be on sysapproval_approver table and not RITM

var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
    gr.state = "2";
    gr.stage = "fulfillment";
    gr.update();
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Viraj Hudlikar
Giga Sage

Hello @harish mandhula 

Check this thread it might be helpful

Solved: Manual Approval workflow - ServiceNow Community

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

Thanks & Regards
Viraj Hudlikar.

Ankur Bawiskar
Tera Patron
Tera Patron

@harish mandhula 

what's the trigger for your business rule?

your business rule should be on sysapproval_approver table and not RITM

var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
    gr.state = "2";
    gr.stage = "fulfillment";
    gr.update();
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,
Thanks for above reply,

In when to Run , what we can use before update/After update and filter condition what we can give state changes to approved/state is approved.
can you please confirm on above.

@harish mandhula 

business rule should be on Approval table (already mentioned by me earlier)

Condition: State Changes to Approval

Script: I already gave

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader