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

Bert_c1
Kilo Patron

If you have a UI action and want to run a script include, see example in the response here:

 

how-to-draft-and-validate-date-on-valid-to-for-knowledge-article

 

for a client script (same script logic can be used in a UI Action) and script include. use of GlideAjax to call the script include and get the results in the client script is shown.