ServiceNow should send the first email follow-up 30 days before the article's expiry date

sukanya kotni
Tera Contributor

 

To: Content Owning groups email, Knowledge Management Group DL ,Group manager. (If no group DL available, please send to all group members and group manager)

CC: Please include the members of XYZ group and add the support group’s SDL’s email. If support group begins with a word "KB" then include PQR group.

Subject: Reminder, KBA expires in 30 days. Review of (Insert KBA number) Owned by “ServiceNow support group name”.

 

Hello (Insert ServiceNow support group name),

 

Please review the Knowledge Article (Insert KBA number) at the earliest and share your response whether the content is valid on its current state or if it require updates. You can also confirm in case any knowledge article need to be retired.

 

Note: If no action is taken, this KBA will be expired on {KBA expiration date in MM/DD/YYYY format} and will no longer be available in the ServiceNow Knowledge Base.

 

 

 

2 ACCEPTED SOLUTIONS

Hi @sukanya kotni from where does the support grp field come? You can do like this below

var grp = current.support_group;

var grp = 'kb';
if(grp.indexOf('kb') > -1)
{

gs.info("KB group found);
// your logic here
}

else if(grp.indexOf('PQR') > -1)

{

gs.info("PQRgroup found);
// your logic here

}

 

to get date format use below logic

var date;
var format;
var kb = new GlideRecord('kb_knowledge');
kb.addQuery('sys_id','d22ce0b197987110df5db8a3f153af47'); // pass article sysid
kb.query();
while(kb.next())
{
date = kb.valid_to;
format = date.getByFormat("MM-dd-yyyy"); // getbyformat
gs.info(format);
}

Regards
Harish

View solution in original post

Hi @sukanya kotni If my answer has helped you. Please accept my solution.

Regards
Harish

View solution in original post

9 REPLIES 9

Hi @sukanya kotni 

var ka = new GlideRecord('kb_knowledge');
ka.addQuery('valid_to',<=', gs.daysAgo(-30)); // you need to add <= here
ka.query();
while(ka.next())
{
var exp = new GlideDateTime(ka.valid_to).getDate(); //Considered valid_to as Article Expiry Date
gs.log("valid date : "+exp);
exp.addDays(0);
gs.eventQueueScheduled("kb.article.remainders", ka, "", "",exp);
ka.update();
}

Regards
Harish

Hi @Harish KM ,

Thanks for the response.

 

I will try to implement the above script.

 

Q: In 'cc' section, If support group begins with a word "KB" then include PQR group and KBA expiration date in MM/DD/YYYY format . Please help me on these mail scripts.

 

Thanks,

Sukanya

 

Hi @sukanya kotni from where does the support grp field come? You can do like this below

var grp = current.support_group;

var grp = 'kb';
if(grp.indexOf('kb') > -1)
{

gs.info("KB group found);
// your logic here
}

else if(grp.indexOf('PQR') > -1)

{

gs.info("PQRgroup found);
// your logic here

}

 

to get date format use below logic

var date;
var format;
var kb = new GlideRecord('kb_knowledge');
kb.addQuery('sys_id','d22ce0b197987110df5db8a3f153af47'); // pass article sysid
kb.query();
while(kb.next())
{
date = kb.valid_to;
format = date.getByFormat("MM-dd-yyyy"); // getbyformat
gs.info(format);
}

Regards
Harish

Hi @Harish KM ,

 

Thank you for your response.

The above logic for date format is working as expected.

 

Thanks,

Sukanya

 

Hi @sukanya kotni If my answer has helped you. Please accept my solution.

Regards
Harish