The CreatorCon Call for Content is officially open! Get started here.

Update the review date of the kb article

v-paulp
Tera Contributor

Hi

We have requirement , to add a option named "update review date" under action button for kb article to the portal(see Below image).

vpaulp_0-1716095584664.png

 

I have  clone the widget named "knowledge article content" and added below script to the clone widget,

HTML CODE
<li class="kb-menu-entry"><a ng-click="c.Review(data.article_sys_id)">{{data.messages.REVIEW}}</a></li>

Client script
c.Review = function(des){
alert(des);
c.data.reviewtime=des;
c.server.update().then(function(){
c.data.reviewtime="";
})
}//update the review date

Server Script 

if(input && input.reviewtime){
var grupdate = new GlideRecord('kb_knowledge');
if(grupdate.get(input.reviewtime)){
var actualreviewdate = grupdate.u_review_date;
var gdt = new GlideDateTime(actualreviewdate);
gdt.addMonths(12);
grupdate.u_review_date=gdt;
grupdate.update();
}
}

 

The button is showing but when I click the button it is not updating the review date the kb article.

Can anyone please where I am making the mistake?

 

Thanks

 

5 REPLIES 5

Community Alums
Not applicable

Hi @v-paulp ,

I tried your script on my background scirpt it works for me please try to add some logs in server script and check it is going inside if(input && input.reviewtime)

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

Hi @Community Alums 

How can I debug widget server script.

Community Alums
Not applicable

Hi @v-paulp 

You can write console.log it will work there.

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

Hi 

Thanks the console.log is working and checked the input it is returning the sys_id of the kb article that means the gliderecord is not executing. 

Do you happen to know is there any other way we can update the value of the kb article form?