- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 10:10 AM
All,
On submission of a catalog item I have a workflow that I intend to generate a report from alm_asset and email it to the requester. I've restricted it managers in our organization and setup the report so it contains all assets where assigned_to.manager is dynamic. This part is working fine.
The issue I'm having is with the automatic report generation and setting the requester's email address in the sysauto_report record.
In the Workflow Run script I have the following:
Neither commented line adds the current users email address to the address_list field on the sysauto_report form.
var gr = new GlideRecord('sysauto_report');
gr.get('name', 'ReportNamehere');
gs.info('User email address' +gs.getUser().getEmail());
//gr.setValue('address_list', gs.getUser().getEmail());
//gr.get('address_list', gs.getUser().getEmail());
SncTriggerSynchronizer.executeNow(gr);
This prevents an email from being generated to the current user.
Solved! Go to Solution.
- Labels:
-
Instance Configuration

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 11:19 AM
use below script. in this script, you can pass sys_id of users in user_list variable.
var scheduled_report = new GlideRecord('sysauto_report');
//Set the scheduled job to active
scheduled_report.active = 'true';
//We add report title and user name to the name for clarity
scheduled_report.name = ''
+ 'Scheduled Email Report of '
+ report.title
+ ' - '
+ user.name;
//Run report as given user to show only his records
scheduled_report.run_as = user.sys_id;
//Sent report to same user, so he receives his own report
scheduled_report.user_list = user.sys_id;
//Only send the report once
//It will be rescheduled if needed
scheduled_report.run_type = 'once';
scheduled_report.report_title = subject;
scheduled_report.report_body = body;
scheduled_report.report = report.sys_id;
scheduled_report.omit_if_no_records = omit;
//Now, insert the newly created scheduled job to start running
//As it is a "once" job, it will run automatically
var answer = scheduled_report.insert();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 10:22 AM
use below script to execute scheduled report
for parameters, you report should contain filters before running this script
var rec = new GlideRecord('sysauto_report');
rec.get('name', 'MyReport');
SncTriggerSynchronizer.executeNow(rec);
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 10:29 AM
Sachin,
That's the same code I have above. I need to populate the email address of the sysauto_report as it is dynamic, based on the user submitting the catalog item.
Thanks,
Brian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 11:10 AM
HI,
I dont know if you saw this on how to set the user in scheduled report dyanamically or not.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 11:19 AM
use below script. in this script, you can pass sys_id of users in user_list variable.
var scheduled_report = new GlideRecord('sysauto_report');
//Set the scheduled job to active
scheduled_report.active = 'true';
//We add report title and user name to the name for clarity
scheduled_report.name = ''
+ 'Scheduled Email Report of '
+ report.title
+ ' - '
+ user.name;
//Run report as given user to show only his records
scheduled_report.run_as = user.sys_id;
//Sent report to same user, so he receives his own report
scheduled_report.user_list = user.sys_id;
//Only send the report once
//It will be rescheduled if needed
scheduled_report.run_type = 'once';
scheduled_report.report_title = subject;
scheduled_report.report_body = body;
scheduled_report.report = report.sys_id;
scheduled_report.omit_if_no_records = omit;
//Now, insert the newly created scheduled job to start running
//As it is a "once" job, it will run automatically
var answer = scheduled_report.insert();