- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 09:06 PM
Hi,
In the OOB email notification script "attach_links", a function attachLinks() is defined. I have the following questions:
1. What is the syntax to call this function in an email notification or email template?
I tried ${mail_script:attach-links.attachLinks()} but it did not work
2. Can it be called in another email notification script?
Thanks,
Debashree
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 09:29 PM
Hello Pati,
1. You just need to include the email script:
${mail_script:attach_links}
If you go to the attach link script you will see that the attachLinks function is already called in the code:
Think of mail scripts as containers of code, once you add them to your email the script is going to be injected into your notification.
2. Technically you could do it, but I think you will have to do it inside your notification. Like this:
${mail_script:attach_links}
<mail_script>
attachLinks();
</mail_script>
If you want to call a function in a script that is defined on another email script just call it like you would do it normally, just make sure that you add the email script that defined the function before calling it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 09:20 PM
Right now I don't have any specific code but would like to have an email notification script with several functions defined within it and then
call these functions in several other scripts, notifications, templates as needed, for modularity. So basically, I am planning my implementation
out at this phase.
Thanks,
Debashree

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 09:23 PM
Hi Debashree,
Its simple
you can call directly
<mail_script>
attachLinks();
function attachLinks()
{
//Do what ever you want inside function
}
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 09:29 PM
Thanks for your reply, Harish. But we are now in Eureka where the tags are not preferred but rather you use email notification script
instead. So suppose you have an email notification script called attach_links, the document says that you can include it in your notification using the syntax:
$. However, if there are functions defined in the script, I am not able to find out how you can call a specific function.
Debashree
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 09:37 PM
Lets suppose that attachLinks wasn't called in the attach links notification script. You could create a new notification script called otherScript and inside that script you could call attachLinks normally. attachLinks();
On your email notification you will need to add both scripts, adding first the one that defined the function.
${mail_script:attach_links}
${mail_script:otherScript}
And that's it, but in the particular case of attach_links script, the function is called inside the script already so no need to call it again (Although technically you could do it)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 09:44 PM
Thanks, Edwin. This is one of the things I was looking for. I will give it a try. -Debashree