Shopping cart - Requested for

kmanning
Giga Contributor

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.

cart - req for.jpg

20 REPLIES 20

So the value never shows on the Shopping Cart Screen but is updated in the Database with the user of the item instead of the person logged into the system.


We have a variable set called common_requested_for which is on each catalog item. This allows a manager to request an item for their employee. On the Shopping Cart screen, it still displays the name and address of the person submitting the request.


Can you provide an example of how your setting the Requested by of the sc_request from the variable of the sc_req_item



Thanks


Assumptions


1) In sc_req_item table you've created a custom field named "u_requested_for"


2) Your Catalog Item has a variable named "v_requested_for" which is auto-populated with the logged-in user, but users can select any other user



Test Case


1. Rob (manager) opens the catalog item, enters Susan's named in the variable "v_requested_for" and fills rest of information then clicks on "Add to Cart"


2. Rob opens again the same catalog item, enters Mike's named in the variable "v_requested_for" and fills rest of information then clicks on "Add to Cart"


3. Rob click checkout and submit request


4. OOB ServiceNow writes Rob in OOB field "requested_for" of sc_request table



Configuration


In sc_req_item table you need a business rule (on before) to copy from variable to field as follows:


current.u_requested_for = current.variables.v_requested_for



Result


Because the cart was submitted with two items, two RITM have been created, one for Mike, another for Susan and parent Request is for Rob.


Oscar,



Once I wrote the script to access the sc_request table I was not able to return the record to update the requested_by field.



That's the problem I'm having.