How to configure If the request was rejected, the closure code must be set to "Request Rejected". ?

siva krishna ch
Tera Contributor

Closure Code:

  • If the request was rejected, the closure code must be set to "Request Rejected". 
    • on the resolution notes, it should show as "user name"  on "system" has been rejected by "name" of the person who rejected the request
1 ACCEPTED SOLUTION

Ramz
Mega Sage

Hi @siva krishna ch ,

Can you explain how the request is rejected. If anyone rejects in the approval table the request gets closed?Also if its in approval table where is the approval getting triggered. In RITM or REQ?

 

 

View solution in original post

4 REPLIES 4

Ramz
Mega Sage

Hi @siva krishna ch ,

Can you explain how the request is rejected. If anyone rejects in the approval table the request gets closed?Also if its in approval table where is the approval getting triggered. In RITM or REQ?

 

 

siva krishna ch
Tera Contributor

Hi @Ramz 

If the RITM is rejected from approvers, the closure code must be set to "Request Rejected".

  • on the resolution notes, it should show as "user name"  on "system" has been rejected by "name" of the person who rejected the request
  • Please find the attached screenshot  

sivakrishnach_1-1714751229380.png

 

 

sivakrishnach_0-1714751212962.png

 

Hi @siva krishna ch ,

So you write a after update business rule in Approver table

when to run:

State changes to Rejected

Script:

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

    var gr = new GlideRecord('sc_req_item');
    gr.addQuery('sys_id', current.sysapproval);
    gr.query();
    if (gr.next()) {
        gr.closure_code = 'Request Rejected'; //CHange to your instance field and backend values
        gr.resolution_notes = '"user name" on "system" has been rejected by' + current.approver.getDisplayName();
        gr.update();
    }
    //Not sure what is user name you are referring to ,if it is any field in form just query them and diplay them

})(current, previous);

 If you need this BR to run for Particular sc_req_item then you can mention them in conditions/script

 

Please mark my answer correct/helpful if it resolved your query

siva krishna ch
Tera Contributor
  • If the RITM was rejected from approvers , the closure code must be set to "Request Rejected". 
    • on the resolution notes, it should show as "user name"  on "system" has been rejected by "name" of the person who rejected the request