- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 07:11 AM
Hello,
We need to send a report on demand to its requestor.
The idea is to have a catalog item requesting a specific report.
Once the request is submitted we can use the dedicated schedule job created for that report and run:SncTriggerSynchronizer.executeNow(job_sys_id);
My question, how can we set the report email recipients dynamically to its requestor only?
Any other option apart from publishing a report with a dedicated URL where we'll be able to provide the data on demand?
Thank you.
Solved! Go to Solution.
- Labels:
-
Service Desk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 08:54 AM
Hey Dan,
If the report is only going to be used for this process. You could set the user_list to the sys_id of the requester only and save the record before triggering the report.
The below is just me testing in a background script with the variable sysid being the report in question and passing my logged in userID as the recepient, for your use case you'd use
current.request.requested_for.sys_id.
var sysid = 'f98c7b992f859c5049375fd92799b615';
var user1 = gs.getUserID();
var report = new GlideRecord('sysauto_report');
report.get('sys_id',sysid);
report.user_list = user1 + '';
report.update();
SncTriggerSynchronizer.executeNow(sysid);
Hope that makes sense? If you need the example inside a workflow do let me know
If my reply helped with your issue please mark helpful 👍 and correct if your issue is now resolved. ✅
By doing so you help other community members find resolved questions which may relate to an issue they're having.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 08:54 AM
Hey Dan,
If the report is only going to be used for this process. You could set the user_list to the sys_id of the requester only and save the record before triggering the report.
The below is just me testing in a background script with the variable sysid being the report in question and passing my logged in userID as the recepient, for your use case you'd use
current.request.requested_for.sys_id.
var sysid = 'f98c7b992f859c5049375fd92799b615';
var user1 = gs.getUserID();
var report = new GlideRecord('sysauto_report');
report.get('sys_id',sysid);
report.user_list = user1 + '';
report.update();
SncTriggerSynchronizer.executeNow(sysid);
Hope that makes sense? If you need the example inside a workflow do let me know
If my reply helped with your issue please mark helpful 👍 and correct if your issue is now resolved. ✅
By doing so you help other community members find resolved questions which may relate to an issue they're having.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2020 04:44 AM
Hi, Checking in on whether my reply resolved your issue? If so please Mark ✅ Correct and /or 👍 Helpful if you find my response worthy based on the impact.
By doing so you help other community members find resolved questions which may relate to an issue they're having.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2020 11:23 AM
Thanks @
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2021 12:06 PM
I tried this with a job that was type "On Demand" and it didn't do anything. I checked and jobs of type "On Demand" do not get picked up by the scheduler. I switched over to type "Once" and it worked like a charm. Now I can trigger my scheduled CSV export of a report to run whenever I want from code. I also needed to update some fields on the sys_report before sending it each time because my report filter can be easily made into a dynamic value. I did it by doing a GlideRecord.update against the sys_report record before triggering SncTriggerSynchronizer.executeNow(reportScheduledJobGR)
Please ✅ Correct if this solves your issue and/or 👍 if Helpful
"Simplicity does not precede complexity, but follows it"