- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 02:38 AM - edited 12-01-2022 02:40 AM
Hi guys,
I want to empty the cart in the self service which have not been checked out withing 7days adding to the cart.
As user the cart should be emptied if its not checked out within 7days.
Thank you.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 02:45 AM
You need to write a scheduled job which runs everyday with below code:
var cart = new GlideRecord('sc_cart_item');
cart.addEncodedQuery('sys_created_on<javascript:gs.beginningOfLast7Days()');
cart.query();
while(cart.next())
{
cart.deleteRecord();
}
Note: All scripts should be tested in dev before executing in prod.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 02:45 AM
You need to write a scheduled job which runs everyday with below code:
var cart = new GlideRecord('sc_cart_item');
cart.addEncodedQuery('sys_created_on<javascript:gs.beginningOfLast7Days()');
cart.query();
while(cart.next())
{
cart.deleteRecord();
}
Note: All scripts should be tested in dev before executing in prod.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 07:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 04:18 AM
Hey Raghav,
Yeah I did some tweaks for the code you send and it worked
Thank you