How to cancel RITM without populating mandatory variables?

Al-JhonV
Kilo Sage

My requirement is to create a UI action that will cancel a ticket from a custom Workspace.
But mandatory variables from onLoad script prevent the UI action to cancel the ticket.

Name: Cancel
action_name: cancel_compliance
Script:

var getChild = new GlideRecord('sc_req_item');
getChild.addActiveQuery();
getChild.addQuery('parent', current.sys_id);
getChild.query();

while (getChild.next()) {
    getChild.variables.link_to_parent_ticket = "";
    getChild.update();
}
current.state = '4';
current.stage = "Request Cancelled";
current.variables.link_to_parent_ticket = "";
current.update();
action.setRedirectURL(current);


Workspace script:

function onClick(g_form) {

g_form.submit('cancel_compliance');

}
0 REPLIES 0