- 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-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
09-05-2018 03:08 PM
Hi, I would like to try this solution for the same issue. What table should be used for the onLoad client script?
Thanks in advance!
Cinthya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 04:39 PM
yep worked as a non roled user too. thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 04:43 PM
dan.bruhn can you please mark Ajit's last reply as correct.
Still seeing the same issue, but I've traced it to when I have to use the "ask a question" button to the right, and if then if I don't mark the discussion as a question, then I can't see the "Correct Answer" option.
Still this is happening because the main "Ask A question" on the home page just freezes. anyway, thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2017 06:49 AM
I've gone ahead and marked Ajit's reply as correct.
We did identify the issue you faced on the homepage and made the update. Can you please try clearing your cache and closing out the browsers? If that doesn't work let me know.
Thanks,