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

Hi Will,



Can you explain more on this. What you want to set and in which field i am confused on this.



Regards,


I want to set the transferred_to field on the Table "Call" to the new Request Number



If you look at the Servicedesk / New Call feature it generates a Request Number within the Transferred To field


Michael Fry1
Kilo Patron

Check out this post for help: Re: Copy New Call Description into Request Item


Mike,


Thanks for this information! it was helpful.



I am trying now to make the business rule write to the new_call table for the field transferred_to to display the request.number, possible can you point me in the direction of a script or something that would accomplish this?


There is a business rule that comes out of the box: Link back to the call that generated it