- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2017 01:51 PM
I'm looking for a way to have an automatic cache out and empty of the cart when an order guide is opened to eliminate the possibility of old or "unchecked out" items being in the cart when the "checkout" page within the Order Guide is reached.
is this possible? thanks!
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 04:33 PM
Patrick, here you go. please mark as correct. also, check impersonating a user with no role.
onLoad client script:
function onLoad() {
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('CartUtil');
ga.addParam('sysparm_name', 'clearCart');
ga.getXMLWait();
}
script include:
var CartUtil = Class.create();
CartUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
clearCart: function() {
var clear = new GlideRecord('sc_cart_item');
clear.addQuery('cart.user', gs.getUserID());
clear.addQuery('active', 'true');
clear.query();
clear.deleteMultiple();
return;
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 09:32 AM
and to refresh...I am looking for a way to have the cart contents clear when a new order guide is opened. We don't use the cart for any other purpose, and as I detailed earlier in the thread, I need the cart to clear when my "New Hire" order guide is first entered so that there is no chance of overlap from previous and unfinished order guide entries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 11:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 11:41 AM
Hi Ajit,
I checked set that system propery to TRUE and the cart still keeps old items from previous order guides...so it didn't work. Wonder if that's because the items that were already in the cart were from the same order guide I'm using to test this. We don't use the cart for anything other than 1 order guide that we're using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 11:54 AM
do u hv 2-step checkout? i tested this, if you hv this property set to TRUE, when you click Order Now, only the present Item will appear in Checkout page. the rest items are still in cart but does not appear at checkout. when you Proceed to Checkout the entire cart will show up.
Are you saying your company does not use cart feature at all and you want to do away with it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 11:44 AM
this is a thread I found, but since it doesn't have "Answered" checked and there seem to be issues with some of the suggestions I wasn't sure if I should follow it.