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

Thank you Ankur for your help, its working.

Now after updating RITM, SCTASK should create automatically, if possible how can we achieve this

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @harish mandhula 

 

Manual addition by the approver in RITM violates the standard process. Better update your flow and fix it fr the long run.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************