Catalog Item Stuck in a Checked Out State

Josh Johnson
Giga Expert

I have an item that was edited in Catalog Builder, then submitted. It's status immediately went to "Checked Out". After waiting a few hours, I looked again and it was still "Checked Out". I attempted to edit it and got the message you see below.

find_real_file.png

 

I went and looked at the Record Producer in Maintain Items and there it said it was in the process of being published. There was no button to "Cancel Checkout". 

find_real_file.png

 

I waited another 12 hrs and nothing changed. It still said "Checked Out" in the Catalog Builder and "Publishing" in Maintain Items. I went to look at the Record Producers and saw 2 entries, on is the one publishing, the other says "Reviewed".

find_real_file.png

Neither will let me let me update them, change their status, or generally do anything. Any suggestions to resolve this? Thanks!

10 REPLIES 10

What is the problem? There is no mention of "Restoring a deleted catalog item" either in the initial post or in my answer. Plus, there is no need to validate if the catalog item is marked as Checked out. May I ask if you intent is to start a new question or suggest a solution?

My intent was suggest an update to your solution. The issue found was I had to modify the script and add one more field, State <state>, and set the value to published:

 

var cat = new GlideRecord('sc_cat_item');
cat.addQuery('sys_id=SYSID');
cat.autoSysFields(false); // This will avoid updating the system fields of the table used
cat.query();

if (cat.next()) {
  cat.setValue('state', 'published'); // Set state to published
  cat.setValue('checked_out', false); // Set checked_out state to false
  cat.setWorkflow(false); // This will override any related Business Rules from stopping the updates
  cat.update();
}

 

Once I ran this, it published the Record Producer.

JSM91
Tera Contributor

Fixed it on our end... tried everything from removing the audit (like one article recommended) editing the state in list view, etc. My fix was exporting the sc_cat_item in XML, modifying the checked_out, allow_edit, and state fields, then re-uploading.. hope it helps.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1166254

JSM91
Tera Contributor

For anyone looking for a solution, here's how I got it to work .. and I tried everything from removing the audit (like one support article recommended), editing the state in list view, reverting versions, etc. My fix was exporting the sc_cat_item in XML, modifying the checked_out, allow_edit, and state fields, then re-uploading.. Hope it helps.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1166254

Community Alums
Not applicable

There is no need to export the XML. Just run a background script and make your changes.
If you're simply wanting to move the item back to Draft so it can be edited in catalog builder use:

var gr = new GlideRecord('sc_cat_item');
gr.get('SYSID'); // Where SYSID is the sysid of your cat item
gr.state = 'draft';
gr.update();

If the item is indeed checked out you can do the same as above for that field. If you run into any issues simply add a setWorkflow(false) in there too. 

Things get a bit messy when you have a published item already, and then you're editing a draft of that item. You need to be weary of the published_ref. 

All the best.