- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2015 11:12 AM
Hey again everyone.
I have the need with a large number of email notifications to put a section "for the administrator" on each email notifcation.
Part of that depends on which table an email notification is running on.
With my lack of scripting expertise, i'm looking for help.
I was a script that i can place on the email notifications with the ${mail_script:"name"} function.
I want to be able to say that if a notification is running on the sysapproval table to print certain things.
if its running on the request item table, print certain things.
so like:
if: table = "value/or sys_id" {
template.print('values')
}
if: table = "value/ or sys_id" {
template.print('values')
}
This gives me the freedom to apply 1 script across EVERY email notification and i can edit it in 1 place.
I dont want to have to create a script for every table to pull certain values into the email notification.
It gives me the ability to say if a specific field is empty, dont template.print.
I tried unsuccessfully to run a vargr script.
i tried a current.sys_class_name
So with my limited scripting, i'm asking the pros now
Any help will be appreciated.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2015 06:28 AM
I would use current.getTableName() to get the name of the table you're on, so:
if (current.getTableName() == 'sysapproval_approver') {
//do approval stuff
}
else {
//do other stuff
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2015 10:52 PM
current.sys_class_name should give you the table name per me. What value is it returning ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2015 08:01 AM
this was giving me an "undefined" result

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2015 06:28 AM
I would use current.getTableName() to get the name of the table you're on, so:
if (current.getTableName() == 'sysapproval_approver') {
//do approval stuff
}
else {
//do other stuff
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2015 08:00 AM
Thanks for the Help Brad. That did exactly what i need. i can now create 1 ${mail_script:} and apply it across all of my email notifications.