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 11:06 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 12:22 AM
Hi @Community Alums
How can I debug widget server script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 12:36 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 03:58 AM
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?