Need to change the status & substatus in RITM , once approver approve the request through outlook

tulasi8
Tera Contributor

Hi Community,

 

This was the notification created on "sc_Req_item" table . So , here whenever user click on the link from body to approve through outlook mail, then it should automatically change the sub status in ritm . How it is possible here ?  please help ! @Ankur Bawiskar 

Request : ${number} is waiting for your approval 
Requested By: ${u_requested_by}
Description of Request and Business Justification/ Case: ${u_cr_details}
Click here to view Request: ${URI_REF}
${mailto:approval}
${mailto:rejection}
${mailto:moreinfo}

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@tulasi8 

you can use after update BR on sysapproval_approver table

Condition: current.source_table == 'sc_req_item'

Script:

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var rec = new GlideRecord('sc_req_item');
    rec.addQuery('cat_item.name', 'Your Item Name Here');
    rec.addQuery('sys_id', current.sysapproval);
    rec.query();
    if (rec.next()) {
        rec.u_substatusField = 'your value'; // give your value here
        rec.update();
    }

})(current, previous);

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@Ankur Bawiskar it's not changing when we are approving through outlook email

@tulasi8 

1 more thing, BR should be after update

Condition: State Changes To Approved

Try to debug as well by adding gs.info()

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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