Shopping cart - Requested for
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 06:28 AM
When a user adds an item to the cart and changes the Requested for field, the Contact information (address) does not update.
Also, the Requested for defaults to the last person the user selected. As you can see Chris Overpeck is logged in and had previously changed the Requested for to Brenda Hoyt and the Contact information (address) did not update. I had him go back in and Brenda Hoyt is still selected as the Requested for. Ideally Requested for would default to the person who is logged in AND if it were changed the Contact information would update to reflect the address of the user that has been selected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 08:10 AM
it is already there.. in delivery address
however you did show me what is missing on that table we have an onchange script set on the requested for that sets the address...
function onChange(control, oldValue, newValue, isLoading) {
var location = gel('requestor_location');
if (!location)
return;
//if (isLoading && g_form.getValue('requestor_location') != "")
//return;
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', newValue);
gr.query();
if (gr.next()) {
// Check if the Users Address is complete
var text = '';
var street = false;
var cityStateZip = false;
if (gr.street != null && gr.street != '') {
street = true;
text = gr.street + '\n';
}
if ((gr.city != null && gr.city != '') && (gr.state != null && gr.state != '') &&(gr.zip != null && gr.zip != '')) {
cityStateZip = true;
text += gr.city + ", " + gr.state + ", " + gr.zip;
}
// If the Users address is not complete
// check if their location has a complete address
// else use the Users partial address
if(!street || !cityStateZip) {
var loc = checkLocation(gr.location);
if(loc != '')
text = loc;
}
g_form.setValue('requestor_location', text);
location.focus();
} else
g_form.setValue('requestor_location', '');
}
function checkLocation( loc_id ) {
var loc = new GlideRecord('cmn_location');
loc.addQuery('sys_id', loc_id);
loc.query();
if(loc.next()) {
var text = '';
if ((loc.street != null && loc.street != '') && (loc.city != null && loc.city != '') &&
(loc.state != null && loc.state != '') &&(loc.zip != null && loc.zip != '')) {
return loc.street + '\n' + loc.city + ", " + loc.state + ", " + loc.zip;
} else
return '';
} else
return '';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 08:11 AM
one other script we have on that table is a set read only script on the requested for.. as an onload script.. i would make sure you do that either in a script or policy to ensure they don't change the requested for on the cart <users do stupid things>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2017 05:27 PM
Raymond,
Can you share the script that makes the Requested for to Read only in the cart?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 03:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 08:29 AM
Hi Kristina,
I usually don't use the OOB requested for field. Although all the suggestions are valid, I've always used the approach of having my own variables for 'requested for' and 'address' pre-populated when the catalog item is loaded using the current logged-in user. Using this approach you will allow the end user to select any user they want from the beginning. Once submitted a simple business rule can run to copy the "requested_for" variable value into the "Requested For" field from the sc_request table.
Considering a biggest approach and having in mind that you're actually using the cart as end user, I've created my own "requested_for" on the sc_req_item level. Consider the scenario where a user might select more than one time the same catalog item and add it into the cart but for different people each item; at the end you may consider the requester on the request level as the end user (current logged-in user) but different individuals on every requested item. This is a common scenario when a manager request items for its subordinates on their behalf.