Custom mail script for SetFrom and SetReplyTo not working for SLA Breach Notifications

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 09:16 AM
Greetings, we have a custom mail script for dynamically changing the from and replyTo addresses on any outgoing mail triggered from the respective record. This mail script has been added to all of our notifications/email templates and appears to be working well, except for some cases.
Here's our script:
Our company records have a checkbox on them named u_service_desk. This script reads the company of the current record, then checks if the u_service_desk checkbox == true. If true, it will dynamically set the replyTo and From address of the outgoing mail.
I can't get this working for the "SLA breached Parm" notification and when I think about it, the SLA record doesn't really have a company field anywhere.
Can someone help me figure out what I can do to allow this mail script to be used by the "SLA breached Parm" notification?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 09:20 AM
If the table doesn't have a company field, the conditions will never be met. However, you can run a gilderecord on it and use that to assign it to the company.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 09:25 AM
Is each SLA record unique for each incident? If you open an SLA record in the Task SLA related list under an incident, is that the SLA record specifically for that one unique incident or is that the universal SLA record used by all incidents?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 09:48 AM
I believe SLA's classify themselves as separate and individual records, and you should be able to query the SLA table for the incident associated with them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 10:01 AM
setReplyTo() and setFrom() both take 2 parameters.
The email string, and the display value.
I'd try adding the value for the Service Desk as as string to pass through email.setFrom(current.company....., "NAME OF SERVICE DESK);
Also, add an else to the IF statement and throw a log in that to see if your code block is hitting or not.
If (current.company.u_service_desk == true) {
// email settings
}
else {
gs.log("Email settings not set", "Email Settings");
}