- 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-18-2020 01:04 PM
Hi Utkarsh,
I just tested your UI Action in my PDI and it was working fine. It is setting the state back to publish if the date is more than current date and if it before the current date then it is aborting the action.
Have you done any customization in your instance. Try checking whether you have any ACL which makes fields readonly when retired and also check any before BR you have written in your instance.
You can also check the link where in you can try using setworkflow(false) or restarting the workflow.
Please mark helpful and correct if it helps
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2020 04:46 AM
Hi CB,
I know it is working fine in my PDI also but dont know why all the fields are greyedout in the other instance. Also checked the ACL & BR.
Thanks/Utkarsh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2020 01:07 PM
Hi Utkarsh,
Can you confirm the version of ServiceNow release in use. As I see OOB there exists one Republish button that shows up for Retired articles. Follow link & just replace yourinstancename in URL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2020 04:40 AM
yes Jaspal we are using new york version & republish button is there but we have to republish approx 300+ retired articles that is manually a difficult task.
Is there any feasible way that we can republish 300+ retired article simultaneously.
Thanks/Utkarsh