- 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:13 AM
Insert line between row 8 and 9
PwdResetCatItem.update();
EDIT: Beat me by a second!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 07:26 AM
Now I just have to work out a notification for this change...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 08:06 AM
When I move this to production, management wants to know it was done.
As a test in my demo environment, I disabled a catalog item with a class of catalog item and that fired off a notification. So, it has something to do with the fact that this is a record producer - which appears to be on a different table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 08:14 AM
Fixed it!
Changed the table from Catalog Item to Record Producer. I also added a name, so that it only triggers on this particular one.
Thanks again Robert for helping me out on this.