- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2018 08:10 PM
So I am new to the Service Desk Call option,
I was able to get the Incident information the way I want, now I wanted to create a General Request item - I have tried using the format of
New call to create generic request`
However it just isnt copying any of my data from the NewCall to the request/item and not actually submitting the request.
Would anyone be willing to share their experiences/code?
basically i want to take
short_description to task short description
description to task description
caller to task requested for
assignment group to task assignment group
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2018 03:54 AM
HI William,
Check this out:
createServiceRequest();
function createServiceRequest() {
var cart = new Cart();
var item = cart.addItem('af695d47314610003e55ce5fcb8deb06');
cart.setVariable(item, 'short_description', current.short_description);
cart.setVariable(item, 'description', current.description);
cart.setVariable(item, 'sr_cmdb_ci', current.cmdb_ci);
cart.setVariable(item, 'sr_resolver_group', current.assignment_group);
var cartGR = cart.getCart();
cartGR.requested_for = current.u_affected_person;
cartGR.update();
var newSerReq = cart.placeOrder();
newSerReq.opened_by = current.caller_id;
newSerReq.update();
var activityLogMsg = 'Your Incident ' + current.number + ' has been cancelled and a Service Request ' + newSerReq.number + ' is created. No action is needed on your part';
current.state = 5;
current.active = false;
current.work_notes = activityLogMsg;
current.parent = getRITM(newSerReq.sys_id);
current.update();
var disMessage = 'Incident ' + current.number + ' has been cancelled and your work will be captured via the newly created Service Request ' + newSerReq.number;
gs.addInfoMessage(disMessage);
action.setRedirectURL(newSerReq);
action.setReturnURL(current);
}
function getRITM(serReq) {
var ritm = '';
var grRITM = new GlideRecord('sc_req_item');
grRITM.addQuery('request',serReq);
grRITM.query();
if(grRITM.next()) {
ritm = grRITM.sys_id;
}
return ritm;
}
Regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2018 08:59 PM
Hi William,
You can generate/submit a request from incident using a business rule on incident table to make sure, it triggers only when an incident is created. make sure you have a catalog item in place to map the variables with the values in incident table.
Request Generation Methods — ServiceNow Elite
Business Rule
When: after
Insert/Update/Delete: true
Condition: <your_condition_here>
createRequest();
function createRequest() {
//Create Request
var cart = new Cart();-
//substitute your cat item
var item = cart.addItem('<sys_id_of_catalog_item>');
//Set Variables in your Cart Item
//substitute your req for
cart.setVariable(item, 'requested_for','00000000000000000000000000000000');
cart.setVariable(item, 'request_short_description', 'Created from Business Rule');
cart.setVariable(item, 'request_description', 'Created from Business Rule');
cart.setVariable(item, 'request_type', 'others');
var rc = cart.placeOrder();
cart.description = 'servicenowelite.com';
var rc = cart.placeOrder();
gs.addInfoMessage('Request Item Created: ' + rc.number);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2018 02:02 AM
Thanks for this information, I am specifically trying to work with the Service Desk / Calls / New Call feature. I have been able to create the request as I need now I am having difficulties writing the Request Number back to the "Call".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2018 03:54 AM
HI William,
Check this out:
createServiceRequest();
function createServiceRequest() {
var cart = new Cart();
var item = cart.addItem('af695d47314610003e55ce5fcb8deb06');
cart.setVariable(item, 'short_description', current.short_description);
cart.setVariable(item, 'description', current.description);
cart.setVariable(item, 'sr_cmdb_ci', current.cmdb_ci);
cart.setVariable(item, 'sr_resolver_group', current.assignment_group);
var cartGR = cart.getCart();
cartGR.requested_for = current.u_affected_person;
cartGR.update();
var newSerReq = cart.placeOrder();
newSerReq.opened_by = current.caller_id;
newSerReq.update();
var activityLogMsg = 'Your Incident ' + current.number + ' has been cancelled and a Service Request ' + newSerReq.number + ' is created. No action is needed on your part';
current.state = 5;
current.active = false;
current.work_notes = activityLogMsg;
current.parent = getRITM(newSerReq.sys_id);
current.update();
var disMessage = 'Incident ' + current.number + ' has been cancelled and your work will be captured via the newly created Service Request ' + newSerReq.number;
gs.addInfoMessage(disMessage);
action.setRedirectURL(newSerReq);
action.setReturnURL(current);
}
function getRITM(serReq) {
var ritm = '';
var grRITM = new GlideRecord('sc_req_item');
grRITM.addQuery('request',serReq);
grRITM.query();
if(grRITM.next()) {
ritm = grRITM.sys_id;
}
return ritm;
}
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2018 06:21 AM
Thank you Ashutosh , I was able to get it working now. I would like for it to generate the "Transferred To" field within the call Table, is there a way to query the call table, find the call in question and write to that table?