knowledge article: author is not able to write after checked by another person

chandan31
Tera Contributor

Hi ,

   author is not able to edit the knowledge article whenver checked by other person and he is receiving error "This article cannot be edited  since it is already checked out ".

 

can y

chandan31_0-1686564851523.png

 

ou tell me which role required to author to edit the knowledge article :

1 ACCEPTED SOLUTION

Riya Verma
Kilo Sage
Kilo Sage

Hi @chandan31 ,

Hope you are doing great.

 

To resolve this issue, there are a few steps we can follow:

  1. we need to identify who currently has the knowledge article checked out. This can be done by querying the sys_updated_xml in ServiceNow. 

 

var articleSysId = '<knowledge_article_sys_id>'; // Replace with the actual sys_id of the knowledge article

var gr = new GlideRecord('sys_update_xml');
gr.addQuery('sys_scope', articleSysId);
gr.query();
if (gr.next()) {
  var lockedBy = gr.locked_by;
  gs.info("The article is currently checked out by: " + lockedBy);
} else {
  gs.info("The article is not currently checked out by anyone.");
}

 

  • Once we identify the person who has the article checked out, request to release the lock. They can do this by navigating to the knowledge article record and clicking on the "Release Lock" button. Or as admin, you can also release the lock on their behalf.

  • If unable to release lock, use unlock record functionality to forcibly release the lock.

 

var articleSysId = '<knowledge_article_sys_id>'; // Replace with the actual sys_id of the knowledge article

var gr = new GlideRecord('sys_update_version');
gr.addQuery('name', articleSysId);
gr.query();
if (gr.next()) {
  gr.unlock();
  gs.info("The article's lock has been forcibly released.");
} else {
  gs.info("The article does not have an active lock.");
}
​

 

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

View solution in original post

3 REPLIES 3

Riya Verma
Kilo Sage
Kilo Sage

Hi @chandan31 ,

Hope you are doing great.

 

To resolve this issue, there are a few steps we can follow:

  1. we need to identify who currently has the knowledge article checked out. This can be done by querying the sys_updated_xml in ServiceNow. 

 

var articleSysId = '<knowledge_article_sys_id>'; // Replace with the actual sys_id of the knowledge article

var gr = new GlideRecord('sys_update_xml');
gr.addQuery('sys_scope', articleSysId);
gr.query();
if (gr.next()) {
  var lockedBy = gr.locked_by;
  gs.info("The article is currently checked out by: " + lockedBy);
} else {
  gs.info("The article is not currently checked out by anyone.");
}

 

  • Once we identify the person who has the article checked out, request to release the lock. They can do this by navigating to the knowledge article record and clicking on the "Release Lock" button. Or as admin, you can also release the lock on their behalf.

  • If unable to release lock, use unlock record functionality to forcibly release the lock.

 

var articleSysId = '<knowledge_article_sys_id>'; // Replace with the actual sys_id of the knowledge article

var gr = new GlideRecord('sys_update_version');
gr.addQuery('name', articleSysId);
gr.query();
if (gr.next()) {
  gr.unlock();
  gs.info("The article's lock has been forcibly released.");
} else {
  gs.info("The article does not have an active lock.");
}
​

 

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Hi , 

 

i know that admin can edit the knowledge article if checked out by any user , but i want that other than admin any other  role is there to edit the knowledge article .

Where is this script run?  Or, how can I create the "release lock" button on the knowledge article form.  There is no "Release Lock" button anywhere on the Knowledge article form.  And, there is no such button already listed in the UI Actions which I thought may have been made inactive on the Knowledge article form.