Scheduled Job Report - Showing access denied

deoreankita
Tera Contributor

Hey Everyone,

 

I'm running a scheduled script that sends out an email with a report attachment.

I have a couple of issues:

 

1. When opening the attachment, some users are seeing errors like "Sender does not have access to this report" or "Access to this content denied based o.n report view acl."

2. For some users, the attachment is getting sent as PDF, while for others, it is correctly being sent as Excel – even though I've explicitly set the format to Excel in the script and used run as system administrator.

 

Has anyone faced this before or know what might be causing these inconsistencies?

2 REPLIES 2

Bhimashankar H
Mega Sage

Hey @deoreankita ,

 

There are couple of checks you need to verify.

 

Sender Does Not Have Access" or "Access to This Content Denied Based on Report View ACL"

These errors happen when the user running the scheduled script (or report) does not have sufficient permissions to the data or report view, even if you specify "Run as System Administrator".

Report View ACL: ServiceNow enforcesreport_viewACLs at both thetableandfieldlevel.

Scheduled Script/Job User Context: Double-check the actual user context for the "Run as" field.

Field ACL:  If the report groups by a field or uses a function field with restricted report_view ACLs, access can be denied even if the table ACL is permissive

 

Resolution Steps:

  • Go to System Security > Access Control (ACL) and filter for report_view operation on both the main table and any relevant fields.

  • Add the required system-level or custom roles to the ACL's "Requires Role" field so the "Run as" user passes the access check.

  • Ensure that all fields used in the report (especially in grouping/aggregation) grant report_view to the "Run as" user.

  • After making ACL changes, test sending the report as the affected user to verify resolution.

 

Attachment Sent as PDF for Some Users, Excel for Others (Despite Script/Setting)

This typically occurs if:

  • Permission Issues Exist: When the scheduler lacks permission to generate the report as Excel, ServiceNow may fall back to PDF or generate an error PDF instead (sometimes with "access denied")

  • Scheduled Report Format Reset: After upgrades or changes, older scheduled reports may have their format reset from Excel to PDF. This can also affect users without the proper role or if the report is not shared with them
  • User Role Restrictions: Users with only report_scheduler may see only PDF options, while admins can select Excel/CSV. If a user not granted access to Excel format schedules the report, outgoing attachments may default to PDF regardless of the script's intent

 

Resolution Steps:

Confirm in the scheduled report/job record:

  • File format/type is explicitly set to Excel (.xlsx or .xls)

  • "Run as" user is active and has admin, report_admin, or applicable roles, as well as the correct ACLs

  • If multiple attachments are generated (e.g., both PDF and Excel), often the PDF contains the ACL error message and is created when the Excel cannot be generated due to access issues. Fixing the permissions as above resolves this

 

For more detail, please go throw the below references Ankita

Solved - Community Resolve this issue 'Access to this content denied based on report_view ACLs 

Report View ACL Restricting access to report data 

Document - Report_view Access Control ,

Sending report in PDF instead of excel ,

Scheduled report creates two attachments ,

 

 

Thanks,
Bhimashankar H

 

-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!

 

Bhimashankar H
Mega Sage

Hi @deoreankita ,

 

Can you mark my answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Future readers with similar kind of question will easily find out. Thanks in advance!

Regards,
Bhimashankar H