- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2020 06:20 AM
Business requirement1. Convert INC to RITM2. Once converted INC ticket should be cancelled and have reference of RITM.3. INC fields details should be mapped with RITM fields (attached screen shot for mapping fields)
============================================================================
Created UI policy
var you_are_elle_path = 'sc_req_item.do?sysparm_incident_id=' + current.sys_id;
action.setRedirectURL(you_are_elle_path);
current.active = false;
current.state = 8; // cancelled state
current.updateWithReferences();
function createRITM() {
var ritm = new GlideRecord("sc_req_item");
ritm.initialize();
ritm.company = current.company;
ritm.u_req_for = current.caller_id;
ritm.u_request_type = current.u_issue_type;
ritm.assignment_group = current.assignment_group;
ritm.configuration_item = current.cmdb_ci;
ritm.short_description = current.short_description;
ritm.description = current.description;
ritm.work_notes = current.work_notes;
ritm.comments = current.comments;
ritm.state = '1';
ritm.priority = current.priority;
ritm.watch_list = current.watch_list.getDisplayValue().toString();
ritm.parent = current.sys_id;
ritm.insert();
//return ritm;
gs.addInfoMessage("Incident has cancelled, Requested Item " + ritm.number + " created.");
action.setRedirectURL(ritm);
action.setReturnURL(current);
}
Assistance needed
1. RITM fields does not have INC fields data
2. INC is getting closed however no reference of RITM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2020 06:16 AM
I achieve the business requirement by using below code:
===========================================================
var you_are_elle_path = 'sc_req_item.do?sysparm_incident_id=' + current.sys_id;
action.setRedirectURL(you_are_elle_path);
var incnumber = current.number;
current.active = true;
current.state = 8;
current.close_code = "Converted to Request Ticket";
current.updateWithReferences();
var ritm = new GlideRecord("sc_req_item");
var ritmnumber = current.number;
ritm.company = current.company;
ritm.u_parent_number = incnumber;
ritm.u_req_for = current.caller_id;
ritm.u_request_type = current.u_issue_type.getDisplayValue();
ritm.assignment_group = current.assignment_group;
ritm.configuration_item = current.cmdb_ci;
ritm.short_description = current.short_description;
ritm.description = current.description;
ritm.work_notes = current.work_notes;
ritm.comments = current.comments;
ritm.state = '1';
ritm.priority = '4';
ritm.watch_list = current.watch_list.getDisplayValue().toString();
ritm.insert();
current.close_notes = "This incident qualifies to be a request, hence incident has cancelled and converted into Requested Item " + ritm.number.getDisplayValue();
current.update();
action.setRedirectURL(ritm);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2020 11:38 PM
When You are creating an RITM from Incident, You need to take care of many things because -
1. RITM's are created from catalog
2. RITMs have associated Request with it
3. RITMs have a workflow which runs for it
In order to acheive the above requirements,-
1. create a catalog with all the fields
2. create a workflow for the catalog
3. Use the API to post a new Request from a UI action-
POST /sn_sc/servicecatalog/items/{sys_id}/order_now
Go through the link below-
https://developer.servicenow.com/dev.do#!/reference/api/newyork/rest/c_ServiceCatalogAPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2020 05:47 AM
Business requirement is not to use REQ nor workflow. As per business, not all incident qualifies to be a catalog item.
So the expectation is - There is general RITM form, incident should be closed and all data to be transferred in general RITM form. Mapping fields are shared in initial query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2020 06:16 AM
I achieve the business requirement by using below code:
===========================================================
var you_are_elle_path = 'sc_req_item.do?sysparm_incident_id=' + current.sys_id;
action.setRedirectURL(you_are_elle_path);
var incnumber = current.number;
current.active = true;
current.state = 8;
current.close_code = "Converted to Request Ticket";
current.updateWithReferences();
var ritm = new GlideRecord("sc_req_item");
var ritmnumber = current.number;
ritm.company = current.company;
ritm.u_parent_number = incnumber;
ritm.u_req_for = current.caller_id;
ritm.u_request_type = current.u_issue_type.getDisplayValue();
ritm.assignment_group = current.assignment_group;
ritm.configuration_item = current.cmdb_ci;
ritm.short_description = current.short_description;
ritm.description = current.description;
ritm.work_notes = current.work_notes;
ritm.comments = current.comments;
ritm.state = '1';
ritm.priority = '4';
ritm.watch_list = current.watch_list.getDisplayValue().toString();
ritm.insert();
current.close_notes = "This incident qualifies to be a request, hence incident has cancelled and converted into Requested Item " + ritm.number.getDisplayValue();
current.update();
action.setRedirectURL(ritm);