Group Approvals still triggering even though we cancel RITM using Cancel RITM button

raj99918
Tera Contributor

Hi 

 

I have 3 group approvals (It's a workflow) after submitting the request am approving the 1st Group approval and 2nd group approval is triggering and then I cancelled the RITM using the button Cancel RITM after this whats happening is 2nd level group approval is set to Non longer required which was working as expected but still it's triggering the 3rd level Group approval which was in Requested state. How can I stop to trigger this 3rd Group approval ?

7 REPLIES 7

SumanthDosapati
Mega Sage
Mega Sage

Did you check how the cancel functionality is configured in your instance? Looks like it's not OOB.

Hi @SumanthDosapati  Below is the UI action :

 

if (typeof window == 'undefined') {
    ritmCancel();
}


function ritmCancel() {

    var getCatalogTasks = new GlideRecord('sc_task');
    getCatalogTasks.addQuery('request_item', current.sys_id);
    getCatalogTasks.query();
    while (getCatalogTasks.next()) {
        getCatalogTasks.state = 7
        getCatalogTasks.u_close_code = 'cancelled';
        getCatalogTasks.close_notes = 'Task Cancelled';
        getCatalogTasks.update();

    }

    var getRitm = new GlideRecord('sc_req_item');
    if (getRitm.get(current.sys_id))
        getRitm.state = 7
    getRitm.stage = 'cancelled';
    getRitm.u_close_code = 'cancelled';
    getRitm.close_notes = 'RITM Cancelled';
  getRitm.update();
action.setRedirectURL(current);
new UICancel().approvalsnotrequired(current.sys_id);


}

Ankur Bawiskar
Tera Patron
Tera Patron

@raj99918 

Please share some screenshots.

OOB this doesn't happen.

Did you check that Cancel RITM button is a custom one and what logic is written within that?

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

Hi @Ankur Bawiskar  Below is the UI action:

 

if (typeof window == 'undefined') {
    ritmCancel();
}



function ritmCancel() {

 

    var getCatalogTasks = new GlideRecord('sc_task');
    getCatalogTasks.addQuery('request_item', current.sys_id);
    getCatalogTasks.query();
    while (getCatalogTasks.next()) {
        getCatalogTasks.state = 7
        getCatalogTasks.u_close_code = 'cancelled';
        getCatalogTasks.close_notes = 'Task Cancelled';
        getCatalogTasks.update();

 

    }

 

    var getRitm = new GlideRecord('sc_req_item');
    if (getRitm.get(current.sys_id))
        getRitm.state = 7
    getRitm.stage = 'cancelled';
    getRitm.u_close_code = 'cancelled';
    getRitm.close_notes = 'RITM Cancelled';
  getRitm.update();
action.setRedirectURL(current);
new UICancel().approvalsnotrequired(current.sys_id);



}