Requested For field is defaulting to logged in user in Service Request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 06:52 PM
Hi all,
We are building our Service Catalog but when we submit a request, the 'Requested for' field on the Request defaults to the persons name who logged the request. We would like to be able to submit requests on behalf of others. We created a Variable Called "Service Recipients Name". This Variable is in a Variable Set called "Common Requested For". We would like to copy its value automatically to the "Requested For" field. (See below) Any ideas?
Thanks,
Luke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2016 03:41 AM
Hi Luke,
Write onSubmit client script on Variable Set:
function onSubmit() {
var reqFor = g_form.getValue('requested_for'); //Your "Common Requested For" variable goes here
var ga = new GlideAjax('<script>'); // Script include to update the cart and set the Requested for
ga.addParam('sysparm_name','populateRequestedFor'); //Script include function
ga.addParam('sysparm_requested_for',reqFor);
ga.getXMLWait();
}
Script include function would be:
populateRequestedFor: function(){
var req_for = this.getParameter('sysparm_requested_for');
var gr = new GlideRecord('sc_cart');
gr.addQuery('user', gs.getUserID());
gr.query();
if(gr.next()){
gr.requested_for = req_for;
gr.update();
}
},
Best Regards,
Vidyasagar A.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2016 03:46 AM
Hi,
Do you have a parent request for this RITM?
And you want to copy requested for which should be same as variables set field what you mentioned, rite?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2016 03:55 AM
Please go through below thread.
Re: I need to map ,field requestor in service catalog to requested for on RITM form..
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2016 04:33 PM
Thanks Mihir, this fixed the issue!
Luke