Shopping cart and Requested for variable problems

dexter74
Tera Contributor

Hi all,

I am currently addressing a Service Portal issue in relation to the shopping cart.  Originally, I had the following use-case scenario:

Original Use Case Scenario

1) ITIL user gets a call from end user for helping in requesting for catalog items through the Service Portal.

2) ITIL user then changes the Requested for variable in his/her user profile

3) ITIL user then proceeds to add catalog items to the requested for users cart but the latest item he inadvertently clicks on the Submit button instead of 'Add to cart'.  At this point, the form is submitted and the items in the current cart (of the Requested for user) are all removed.  The client did not like this behavior of items being removed without proper notice.

I was tasked to stop the process of submission if there are any items in the current shopping cart and prompt the ITIL user that there are items in the shopping cart.  If they want to proceed with submission then the cart items will be removed and the current catalog item will be submitted for request otherwise the submission will stop.

After implementing the code logic last week and reviewing it again today for delivery, I was testing it again and for some reason the code wasn't working the way it was last week.

I did my investigation and found out that the add to cart functionality is no longer adding the catalog item to the requested for person's cart.  It was adding the catalog item to the currently logged in users' cart (ITIL).  As you may imagine, this is throwing a big monkey wrench in my code's logic.  Any ideas?  Nobody else is working on the shopping cart except me.

 

2 REPLIES 2

Bhagyashree8
Kilo Guru

Hi,

Can you please provide code snippet you might think is not working properly and which instance version are you on?


Mark my ANSWER as CORRECT / HELPFUL if it served your purpose.

 

dexter74
Tera Contributor

Hi Bhagya,

 

The assumption is that in a service catalog, if the current user changes the requested for variable in their user profile, and then adds items to the shopping cart.  The shopping cart that gets filled with those items is the DEFAULT shopping cart of the user that is defined in the requested for field.  I was working on this assumption last week and have created code based on this.  However, it seems that changing the requested for variable in a service catalog item widget does not add the item to that requested for users' shopping cart.  It does add the item to the currently logged in users shopping cart.

 

The following code snippet is OOB

$scope.triggerAddToCart = function() {
    $scope.data.sc_cat_item.item_action = "add_to_cart";
    $scope.data.sc_cat_item.quantity = c.quantity;
    if (g_form)
        g_form.submit();
}

 

The requested for definitely changed to another user NOT the currently logged in user.