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

sachin_namjoshi
Kilo Patron
Kilo Patron

What's error message you are getting for after calling email script?

 

Regards,

Sachin

This is the full error that I'm getting.

com.glide.script.fencing.CrossScopeAccessNotAllowedException: Access to TemplatePrinter.print from scope scopeName not allowed  

Caused by error in Email Script: 'test' at line 1==>  

1: (function runMailScript(current, template, email, email_action, event) {     

2:     template.print('Hello World');     

3:           // Add your code here     

4:

Please make sure that email notification and email script and email template scopes are same.

This is the issue.

 

Regards,

Sachin

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.