Need to search for records with specific date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 10:13 AM
Hello All,
I am looking to search knowledge articles that are going to expire before 14/7/3/1 days from the current valid to date.
I have written my code in Workflow if activity;
answer = ifScript();
function ifScript() {
var a = "valid_toRELATIVEEE@dayofweek@ago@14";
var gr = new GlideRecord('kb_knowledge');
gr.addEncodedQuery(a);
gr.query();
if (gr.next()) {
if (a == 'true') {
gs.log('inside_if');
return 'yes';
}
else{
gs.log('inside_else');
return 'no';
}
The yes transition to send reminder notification and no transition checks for another if activity;
function ifScript() {
var a = "valid_toRELATIVEEE@dayofweek@ago@7";
var gr = new GlideRecord('kb_knowledge');
gr.addEncodedQuery(a);
gr.query();
if (gr.next()) {
if (a == 'true') {
gs.log('inside_if');
return 'yes';
}
else{
gs.log('inside_else');
return 'no';
}
Similarly for 3 and 1 day...
Result : inside_else gets printed.
Thanks,
Arun Devendran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 03:52 AM