Referencing "Request For" While Ordering a Catalog Item

benn32
Kilo Contributor

Does anyone know of a way to grab the 'Request For' value (from the main catalog page) from within a catalog item?
We fear that some of our users will over-look the "Request For" field, which should be defaulted to their User ID. So, they'll click on an item and fill out the 'request for' information (variables) of someone other than themselves, but in actuality, the request will still say it's requested for the person making the request. It would be nice if on load of the item, we could pass the 'request for' value from the main catalog page to the item, and auto-populate some of the user's info. If the 'request for' is changed from within the item, ideally we'd like to pass that value off to the request.
Has anyone done this? If so, we'd really appreciate some guidance!
Thanks.

18 REPLIES 18

hi,

from the cart, can it pass values to the request?

does order guide uses cart?

I was push into using order guide as I can't make the glide list work in using the normal request cart

so my current process is

order guide has glide_list, it passes glide_list to item, item passes glide_list to request.

if you have any simpler way please please , share, as I am having trouble making this work with workflow

thanks

quik


As of the Winter 2010 release you can access sc_cart_item during the creation of sc_req_item.
Not sure how this would fit in to your needs but here's the example I built it for. I was creating related records to sc_cart_item and when the cart was processed I needed to update those related records to point at the new sc_req_item.
In a business rule on sc_cart_item (on insert) I use:



//get allocation records
var alloc = new GlideRecord('u_allocations');
//find all allocations matching the sc_cart_item record
alloc.addQuery('u_doc_id', current_cart_item.sys_id);
alloc.query();

As you can see "current_cart_item" is exposed and represents the glide record of the cart item that is being processed. This object only lives during the insert of sc_req_item.


hi

is this the same as sc_cart?

I was able to pass values to this table, but can't pass it from sc_cart to request

quik


I needed to do something similar, and used a Catalog Client Script for the catalog item (onSubmit). Something like:

function onSubmit() {
var for_userid = g_form.getValue('name' );
var userid = g_user.userName;
var cart = new GlideRecord('sc_cart');
cart.addQuery('user.user_name', userid);
cart.query();
if (cart.next()) {
cart.requested_for = for_userid;
cart.update();
}
}

You will need to use your own rules for setting the value of for_user_id.
This then gets copied to the sc_request field.


I've been using this Client Script for a while now and it has worked beautifully, but just noticed that it is not working lately in our DEV environment, which is on June 2011. The script does work if the user has the 'admin' role, but the requested_for field on the sc_cart table simply will not update for anyone else.

We have recently enabled the High Security Plugin and I'm wondering if that has affected how the script works. I've tried a few different ACLs, but no luck. In fact, it looks like ACLs on the sc_cart table are completely ignored.

Has anyone seen this problem appear with High Security? I have another client/instance on Summer 2011 without High Security and it still works OK.