- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 06:53 AM
I have a simple scheduled job script that I want to inactivate a record producer catalog item at a specific time. Below is my script, but the active flag is still checked when I execute it. I have ran this through a background script by adding gs.print statements and it says the flag is flipping to false. Could someone please tell me what I am missing here?
var PwdResetCatItem = new GlideRecord('sc_cat_item');
PwdResetCatItem.addQuery('name','Password Reset');
PwdResetCatItem.addActiveQuery();
PwdResetCatItem.query();
while (PwdResetCatItem.next()) { // if the catalog item is still active, inactivate it
PwdResetCatItem.setValue('active',false);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 07:16 AM
If you're just dealing with one Catalog Item, I'd probably not bother with a while statement at all.
var item = new GlideRecord('sc_cat_item');
item.get('<sys_id of Password Reset item>');
item.active = false;
item.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 07:30 AM
gs.log("Item active set to " + item.active);
Add that to the line below the update.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 07:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 07:44 AM
If you're trying to find out if the script is successful, I'd use logs instead of notifications.
As for your notification, the conditions look ok. I'd go to the Who Will Receive and make sure you actually have someone specified. I'd also make sure the "send to event creator" is checked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 07:58 AM
I'm manually inactivating the item, to get the notification to fire off. The scheduled job is working now, thanks to you.
I've got me ask the User as well as the "Send to event creator" checked, but it's still not firing. Could it have anything to do with it being a record producer and not a standard catalog item? I'm grasping at straws here...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 08:02 AM
Sure, that's probably one good reason. But I'm still uncertain why you need the notification at all.