Knowledge Base review date update

Ballela Siva Te
Tera Contributor

Hi Team,

 

We have created a field called review date in knowledge article. The review date should be updated when published date changes. For example if the published date is today review date should be six months to current date. Can you provide script which I can incorporate over business rule

 

Regards,

B Siva Teja

1 ACCEPTED SOLUTION

AndersBGS
Tera Patron
Tera Patron

Hi @Ballela Siva Te ,

 

Something like below should be able to do the trick:

(function executeRule(current, previous /* previous values from the form */) {

    // Get the published date from the current record
    var publishedDate = current.published_date; // Change 'published_date' to the actual field name

    // Check if the published date is populated
    if (publishedDate) {
        // Calculate the review date (6 months ahead)
        var reviewDate = new GlideDateTime(publishedDate);
        reviewDate.addMonthsLocalTime(6);

        // Set the review date in the appropriate field
        current.review_date = reviewDate; // Change 'review_date' to the actual field name
    }

})(current, previous);

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

View solution in original post

5 REPLIES 5

Anand Kumar P
Giga Patron
Giga Patron

Hi @Ballela Siva Te ,

Try below script in your business rule.

if (current.published != previous.published) {
var reviewDate = new GlideDateTime(current.published.getDisplayValue());
reviewDate.addMonths(6);
current.u_review_date = reviewDate;
}

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand