Unexpected Creation of 5000+ Records in sc_req_item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
(function executeRule(current, previous) {
if (!(current.active.changesTo(false))) {
return;
}
var cart = new Cart(GlideGuid.generate(null));
cart.setRequestedFor(current.sys_id.toString());
var cartItem = cart.addItem('sys_id_of the catalog item');
cart.setVariable(cartItem, 'requested_for', current.sys_id.toString());
cart.setVariable(cartItem, 'user_name', current.name.toString());
cart.setVariable(cartItem, 'email', current.email.toString());
cart.placeOrder();
})(current, previous);
I implemented an After Update Business Rule on the sys_user table to automatically trigger a catalog item whenever a user is deactivated (Active changes from true to false).
The Business Rule uses cart.placeOrder() to create a request for the catalog item. However, after deploying it, I observed that more than 5000 records were automatically generated in the sc_req_item table, including records for users who were not intentionally deactivated.
could any assist me to figureout what could be the reason.