Unable to call mail script in scoped application

samadam
Kilo Sage

I have a mail script that I am calling from notification but get a message script is not found. I tried to call it using scope name like ${mail_script:my_scope.getinfo} but did not work. How can i do this?

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi,

Firstly, as others have mentioned, you shouldn't need to call your scope within the mail script, you just need the mail script name.

Secondly, I've seen this issue when people copy and paste code from somewhere else in to their notification.

Within your notification, please open that and go to the "What it will contain" tab, then click the "<>" (source code) button in the Message HTML section:

find_real_file.png

And check to see if there are any <span> tags, etc. around your mail script call. If so, please remove them.

Please mark reply as Helpful/Correct, if applicable. Thanks!

 


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

11 REPLIES 11

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Your mail script and notification are both in the same scope? If so, it should certainly work, no need to prefix with your scope or something.

Can you share exactly what you tried? And can you share an example of the issue?

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hey @Mark Roethof 

<<Your mail script and notification are both in the same scope>>

Yes my mail script and notification are in same scope but my scenario is I need to access this notification in some different scope which is working fine, notification is getting triggered but the email script is not performing the result as expected for the notification.

Can you let me know, will the email script not work if we call the notification from some different scope ?

samadam
Kilo Sage

Yes, both are in the same scope.

This is the error I get:

Email script render error: email script [mail_script:my_scope.getinfo ] does not exist

In the mail script I just added a simple line to test. Even that doesn't work. I looked to see if there are any html characters that might be causing the problem but didn't find any.

template.print('This is Test');

Yes but why the my_scope?

I just tested without, works fine.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn