Scope error with template.print

James Michaels1
Giga Expert

I have a notification script which uses template.print. On Dev, which I just cloned from production over the weekend, the email displays properly with the printed information. On production I get a cross scope error for "template". It was my understanding that "template" should be available from all scopes and my experience on Dev bears that out. Has anyone run into an issue like this and have a solution?

1 ACCEPTED SOLUTION

James Michaels1
Giga Expert

So it turned out that the issue was that the application scope wasn't enforcing cross scope privilege on Dev but was on Production. Since it wasn't enforcing it on Dev it didn't create cross scope privilege records as they were needed. So to fix it I needed to create a cross scope privilege record to access TemplatePrinter.print.

View solution in original post

8 REPLIES 8

The SN Nerd
Giga Sage
Giga Sage

My guess would be that the Email Template that calls the Mail Script is in a different scope.
Ensure they are both in the same Application Scope and try again.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

I created a new notification with nothing but a mail script to print hello world and it still gives me the scope error using template.print in the script. I checked and both the notification and the mail script are in the same scope for both my test notification and the original.

James Michaels1
Giga Expert

So it turned out that the issue was that the application scope wasn't enforcing cross scope privilege on Dev but was on Production. Since it wasn't enforcing it on Dev it didn't create cross scope privilege records as they were needed. So to fix it I needed to create a cross scope privilege record to access TemplatePrinter.print.

Dawid Kowal
Tera Contributor

Thanks James, it is useful. This is how it should look like from scoped app:

find_real_file.png