how to republish the retried KB artciles

utkarsh6
Giga Contributor

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

1 ACCEPTED SOLUTION

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.

View solution in original post

15 REPLIES 15

Chander Bhusha1
Tera Guru

Hi Utkarsh,

I just wanted to follow up on this issue. If this issue is resolved or not.

If yes, then can you please mark my reply as correct and helpful. It will move this question to solved questions list and others can refer the solution in future.

Thanks,

CB