- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 04:03 PM
I am trying to generate an expiration notification from my scheduled job. Notification should go 30 days prior to the expiration date, which is catalog variable.
The first query is what I am trying and failing variables.908016f5db9c3340a1d116494896199fRELATIVEEE@dayofweek@ahead@30
var gr = new GlideRecord("sc_task");
// this does not work.
gr.addEncodedQuery('request_item.cat_item=3ae70705db98bf00a1d11649489619ed^state=3^assignment_group=eaf43fe9db603300a1d11649489619d7^variables.8410deb5db9c3340a1d116494896194b=Approve^variables.908016f5db9c3340a1d116494896199fRELATIVEEE@dayofweek@ahead@30^sys_created_onONLast 3 months@javascript:gs.beginningOfLast3Months()@javascript:gs.endOfLast3Months()');
Any help on this is highly appreciated.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 09:53 PM
Hello Rajini,
Could you please check with below script once:
var expiryDateGDT = new GlideDateTime();
expiryDateGDT.addDays(30);
var expiryDate = expiryDateGDT.getDate();
var query = "request_item.cat_item=3ae70705db98bf00a1d11649489619ed^assignment_group=eaf43fe9db603300a1d11649489619d7^state=3^variables.8410deb5db9c3340a1d116494896194b=Approve^variables.908016f5db9c3340a1d116494896199fON" + expiryDate +"@javascript:gs.dateGenerate('" + expiryDate + "','start')@javascript:gs.dateGenerate('" + expiryDate + "','end')^sys_created_onONLast 3 months@javascript:gs.beginningOfLast3Months()@javascript:gs.endOfLast3Months()";
var gr = new GlideRecord("sc_task");
gr.addEncodedQuery(query);
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 09:53 PM
Hello Rajini,
Could you please check with below script once:
var expiryDateGDT = new GlideDateTime();
expiryDateGDT.addDays(30);
var expiryDate = expiryDateGDT.getDate();
var query = "request_item.cat_item=3ae70705db98bf00a1d11649489619ed^assignment_group=eaf43fe9db603300a1d11649489619d7^state=3^variables.8410deb5db9c3340a1d116494896194b=Approve^variables.908016f5db9c3340a1d116494896199fON" + expiryDate +"@javascript:gs.dateGenerate('" + expiryDate + "','start')@javascript:gs.dateGenerate('" + expiryDate + "','end')^sys_created_onONLast 3 months@javascript:gs.beginningOfLast3Months()@javascript:gs.endOfLast3Months()";
var gr = new GlideRecord("sc_task");
gr.addEncodedQuery(query);
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 03:39 PM
Thank you so much. It worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2023 11:09 PM
Hi @Mahendra RC ,
I have almost the same requirement.
I have created a date (u_duration)field in the catalog form.
Suppose I am putting u_duration as 12/31/2024.
30 days before the Duration date is reached, we have to notify requested for and "abc" group that your ticket is expiring.
I posted this question in community. Please check and kindly provide me the solution.
Thanks!
Samiksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 09:57 PM
Hi,
if the 2nd is working then what's the challenge?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader