ServiceDesk Call create generic request

williame
Tera Contributor

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

1 ACCEPTED SOLUTION

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI William,



Check this out:


Service catalog script API



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,


View solution in original post

20 REPLIES 20

ok so have been wracking my brain here and decided to use a script on my workflow to try to query the call record can you look at this code and let me know what is wrong with it?




var cal = new GlideRecord("new_call");


cal.query();


while (cal.next()) {


if (cal.number == current.variables.call_number) {


cal.transferred_to = current.number;


cal.update();


}


}


Hi Will,



Where have you written Cart Script on Call table?



Thanks


I am trying to run this script from a workflow - i get it to trigger just fine - however i think my syntax for the query are incorrect.


While I realize you're new, what I don't understand is what happens when you have more Catalog items? This solution means you are always transferring a Call to the same 1 Request. We transfer Calls to 10 different catalog items today using out of the box code.



The other thing, you shouldn't have to create the Catalog task. Your workflow, from the catalog item, should trigger and create the task and drive your process.


Thanks for the reply. This is only for the New Call for service desk. So


our techs will answer the call enter the info and it will either create an


incident or a general request. Our service desk won't be entering any other


requests so it was simpler to generate the request, ritm and task via the


script I posted earlier. This script also sets a variable the workflow


picks up and skips the workflow. Hope this makes sense.



On Jan 21, 2018 10:42 PM, "Michael.Fry" <community-no-reply@servicenow.com>