Setting valid_to date of Knowledge article to 6 months after published date

neetika
Tera Contributor

Hi all,

I have written a business rule to set the valid_to date of Knowledge article to '6 months after published date'

This runs when n article is published, so an 'After' 'update' BR is used when 'State' changes to 'published'.

(function executeRule(current, previous /*null when async*/) {

var gdt= current.published.getGlideObject();

  //gs.addInfoMessage("time:"+gdt);

  current.valid_to = gdt.addMonthsLocalTime(6);

})(current, previous);

Above is the script, but its not working. Something is missed.

Please correct me.

10 REPLIES 10

neetika
Tera Contributor

Also , I would like to add one more problem here apart from one mentioned above.



When I publish that article, the state is changed to published but the same is not reflected under the knowledge management console.


Hi Neetika,



What are you referring to when you say Knowledge Management Console? While knowledge is not my forte, I know the basics and I haven't been introduced to any knowledge management console yet. Is it a home page? Dashboard? Custom implementation? A screenshot would be helpful. Thank you


I mean the Home Page.


You will need to check in to the details of what is on that home page (gauges, reports, etc) and how they are defined. I don't have that information available at the moment.


Hi Chuck,



I am talking about Knowledge Home Page. See below for your reference.


And I changed the code to what you have mentioned but again the same problem. I think the code/workflow that makes it to Publish is somewhat resisting to modify the valid_to date. Not sure.




find_real_file.png