create a ui action to create incident from ritm.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2019 02:53 PM
Hi All,
I have a requirement to create a ui action on RITM table that will create an incident and cancel the current RITM.
And there should be a "confirmation box" when users clicks submit the action should take place.
And also all the variables on RITM should be copied to Description on the incident form. can somebody help ?
Thanks,
VC.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2019 03:08 PM
This is available OOB with UI action to create incident from requested item.
Please see below
https://docs.servicenow.com/bundle/london-servicenow-platform/page/use/service-catalog-requests/task/create-incdnt-chngrqust-rqustditem.html
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2019 03:15 PM
Our requirement is something more than the OOB one. We need to copy almost all the field values from RITM to Incident, And we need to have a confirmation pop up once user click the button and also, need to copy the "variables" values on the RITM to incident's description field.
Thanks,
VC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2019 03:17 PM
The below is my code, I need to have it on client side to pop up a confirmation box, But GlideRecord is not being called on client side. I need help with having script include and glide ajax calls. i am new to this.
function onClick(){
var ans = confirm("Please confirm - This process cannot be reversed");
if (!ans)
return false;
gsftsubmit(null,g_form.getFormElement(),'cancel_ritm_create_inc');
}
if(typeof window == 'undefined')
createInc();
function createInc(){
var inc = new GlideRecord('incident');
inc.initialize();
inc.caller_id = current.request.requested_for;
inc.assignment_group = current.assignment_group;
inc.assigned_to = current.assigned_to;
inc.short_description = current.short_description;
inc.description = current.variables;
inc.opened_by = gs.getUserD();
inc.parent = current.sys_id;
inc.insert();
//var sysid = inc.insert()
//current.parent = sysid;
GlideSysAttachment.copy('sc_req_item', current.sys_id, 'incident', inc.sys_id);
current.state ='7'; // state "cancelled"
current.stage='cancelled';
current.approval = 'rejected';
current.closed_by = gs.getUserID();
current.update();
//var mySysID = current.update();
gs.addInfoMessage("Incident " + inc.number + " created");
action.setRedirectURL(inc);
action.setReturnURL(current);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2019 03:38 PM
Please see solution below to create incident from request with code
https://community.servicenow.com/community?id=community_article&sys_id=0aac2625dbd0dbc01dcaf3231f961952
Regards,
Sachin