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');

}
1 ACCEPTED SOLUTION

Hello @glideFather , thanks for your reply. 
I already figured out my requirement, I put my client side script in the Workspace Client Script and it worked.


AlJhonV_0-1782954022995.png

 



View solution in original post

2 REPLIES 2

glideFather
Tera Patron

ahoy @Al-JhonV,

 

wouldn't it be easier to ensure that a RITM is not created without required fields? Or how does it happen that you have a RITM with empty mandatory fields?


✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---

Hello @glideFather , thanks for your reply. 
I already figured out my requirement, I put my client side script in the Workspace Client Script and it worked.


AlJhonV_0-1782954022995.png