Knowledge base UI action button

Ballela Siva Te
Tera Contributor

Hi Team,

We have to write an UI action on knowledge base table.

So when an knowledge article is created and published the review date will be 6 months to published date.

so lets say the Knowledge article is published on 28th May 2024 the review date would be 27th Nov 2024.

So now my requirement is to create a UI action button which has to appear before 15 days to review date i.e 12 Nov 2024 and when clicked on it the review date should go next six months 26 May 2024

 

Can you please guide me with condition and script

 

Regards,

Siva Teja B

1 ACCEPTED SOLUTION

Amitoj Wadhera
Kilo Sage

Hello @Ballela Siva Te ,

 

Here's how your UI Action form should look:

  • Name: Extend Review Date
  • Table: Knowledge (kb_knowledge)
  • Action name: extend_review_date
  • Show insert: Unchecked
  • Show update: Checked
  • Show on form: Checked
  • Condition:

 

var reviewDate=current.review_date,today=new GlideDateTime,fifteenDaysFromNow=new GlideDateTime;fifteenDaysFromNow.addDaysLocalTime(15);

 

  • Script:

 

    var reviewDate = new GlideDateTime(current.review_date);
    reviewDate.addMonthsLocalTime(6);
    current.review_date = reviewDate;
    current.update();
    gs.addInfoMessage('The review date has been extended by six months.');
    action.setRedirectURL(current);

 

 

 

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

 

Thanks,

Amitoj Wadhera

View solution in original post

2 REPLIES 2

Amitoj Wadhera
Kilo Sage

Hello @Ballela Siva Te ,

 

Here's how your UI Action form should look:

  • Name: Extend Review Date
  • Table: Knowledge (kb_knowledge)
  • Action name: extend_review_date
  • Show insert: Unchecked
  • Show update: Checked
  • Show on form: Checked
  • Condition:

 

var reviewDate=current.review_date,today=new GlideDateTime,fifteenDaysFromNow=new GlideDateTime;fifteenDaysFromNow.addDaysLocalTime(15);

 

  • Script:

 

    var reviewDate = new GlideDateTime(current.review_date);
    reviewDate.addMonthsLocalTime(6);
    current.review_date = reviewDate;
    current.update();
    gs.addInfoMessage('The review date has been extended by six months.');
    action.setRedirectURL(current);

 

 

 

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

 

Thanks,

Amitoj Wadhera

@Amitoj Wadhera : Thanks for your valuable answer

 

Can you please explain what the below script does ?

var reviewDate=current.review_date,today=new GlideDateTime,fifteenDaysFromNow=new GlideDateTime;fifteenDaysFromNow.addDaysLocalTime(15);

Thanks

B Siva Teja