Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

@Michael Fry


We are just now starting to explore this feature. We wanted to start out with a single General Request and then build from there. Currently our catalog items were built by different people so the variable names etc are all different. I was having some issues getting the variables to transfer from the New Call to the Catalog Item/cart.