Update the review date of the kb article
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2024 10:15 PM - edited 05-18-2024 10:15 PM
Hi
We have requirement , to add a option named "update review date" under action button for kb article to the portal(see Below image).
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 12:57 PM
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.