- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 12:44 PM
Hi All,
This is regarding the knowledge articles that I want to republish the retried articles.
I have tried the way suggested on community that I have a created a UI action named as publish that is only for articles that are retried using below script & logic. But it is not working, a UI button has sucessfully come on KB form but everything is greyedout even though I have impersonated with the assigned to user. But it is still greyed out. I am unable to edit the Valid to field on KB form.
when I am clicking on Publish button that I have created on the form for retrired articles not working as expected.
Please refer below script & UI action and also please suggest a another way or make my corrections in this .
Method->
Create a UI action with condition current.workflow_state=='retired', which will show the UI Action only on retired knowledge articles.
Set up the UI action as follows:
Table: kb_knowledge
Active: true
Show Insert: true
Show update: true
Form button: true
Condition: current.workflow_state=='retired'
Script->
if(current.valid_to <= gs.nowDateTime()){
gs.addInfoMessage('Invalid date.Please enter future date');
current.setAbortAction(true);
}
else
{
current.workflow_state = 'published';
current.update();
}
action.setRedirectURL(current);
Thanks/Utkarsh
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 07:39 AM
Hi Utkarsh,
It was missed. Try below.
var kbis=new GlideRecord('kb_knowledge');
kbis.addEncodedQuery('workflow_state=retired');
kbis.query();
while(kbis.next())
{
kbis.valid_to='28-06-2020';
kbis.update();
}
This sets the date in future to retired articles then you can use Republish option as suggested above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 01:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2020 02:17 AM
Hi Jaspal,
Any update on this.
Thanks/Utkarsh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 07:39 AM
Hi Utkarsh,
It was missed. Try below.
var kbis=new GlideRecord('kb_knowledge');
kbis.addEncodedQuery('workflow_state=retired');
kbis.query();
while(kbis.next())
{
kbis.valid_to='28-06-2020';
kbis.update();
}
This sets the date in future to retired articles then you can use Republish option as suggested above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2020 12:31 AM
Hi Jaspal,
Thanks for providing this solution.
Can you please look into this new requirement:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2020 04:49 AM
Hi Utkarsh,
You can write a fix script or background script to update the knowledge article to republish
The below script will served the purpose.
var kb = new GlideRecord('kb_knowledge');
kb.addQuery('workflow_state','retired');//Checking retired articles
kb.query();
whiled(kb.next())
{
//If valid to is not less than current date
if(!kb.valid_to <= gs.nowDateTime()){
kb.workflow_state = 'published';
kb.update();
}
}
Mark helpful and correct if it helps.
Thanks
CB