- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2021 09:39 PM
Hello, I'm not sure what I am missing here. Executing Scheduled Email of Report with below condition script. If I hardcode the grList value, it is working. This schedule is
var answer=false;
var scheduleReport = new GlideRecord('sysauto_report');
scheduleReport.get(current.sys_id); //Sys ID of your schedule Report
var tablename = scheduleReport.report.table;
var query = scheduleReport.report.filter;
var grpList='';
var gr=new GlideRecord(tablename);
gr.addEncodedQuery(query);
gr.query();
while (gr.next()) {
var grp=gr.getValue('assignment_group');
grpList += ',' + grp;
}
//var grList='679434f053231300e321ddeeff7b12d8,8a5055c9c61122780043563ef53438e3';
if (grList.length>0) {
current.group_list=grList;
current.update();
anwswer=true;
}
Thanks, Babeth
Solved! Go to Solution.
- Labels:
-
Reporting

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2021 10:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2021 10:42 PM
Adding another point, current object will not work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2021 10:45 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2021 12:35 AM
Thank you Harshvardhan! With that, I created scheduled script execution that triggers the scheduled report instead. The report has the PDF file type which I need. Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2021 10:08 AM
Would you mind providing an example of the scheduled script? I have a similar problem and would appreciate any guidance you can provide. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2021 05:01 AM
Sharing what I recall from this topic.
1. Scheduled report
2. Scheduled script
new global.ScriptIncludeNameHere().notifyAssignmentGroups('Report name');
Below is the script include:
notifyAssignmentGroups: function (schdRptName) {
var grpList=[];
var rec = new GlideRecord('sysauto_report');
rec.get('name', schdRptName);
var tsk = new GlideRecord(rec.report.table);
tsk.addEncodedQuery(rec.report.filter);
tsk.query();
while (tsk.next()) {
var grp=tsk.getValue('assignment_group');
if (this._isAlreadyAdded(grp, grpList))
continue;
grpList.push(grp);
}
//gs.log(grpList);
rec.setValue('group_list', grpList);
rec.update();
SncTriggerSynchronizer.executeNow(rec);
}
Hope this helps!