Set the Notification 'From' and 'Reply To' addresses as Variables

Jamie Imms
Kilo Expert

Hi,

I was hoping to create a catch-all notification for emails from other systems. Depending on the source, I was hoping the notification 'From' and 'Reply to' could be dynamic based on the source (you would be able to dot-walk to it).

However:

find_real_file.png

Does anyone know of a workaround to this? I was hoping to avoid creating a different notification for every source.

1 ACCEPTED SOLUTION

Jamie Imms
Kilo Expert

I managed to sort this out, by using a notification script.



I created an email script containing this:



Name: u_commsource_from


(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,


                  /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,


                  /* Optional GlideRecord */ event) {




email.setFrom(current.u_communication_source.u_newfrom);


email.setReplyTo(current.u_communication_source.u_newfrom);




})(current, template, email, email_action, event);



And simply put this in the Message field of the Notification:


${mail_script:u_commsource_from}


View solution in original post

1 REPLY 1

Jamie Imms
Kilo Expert

I managed to sort this out, by using a notification script.



I created an email script containing this:



Name: u_commsource_from


(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,


                  /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,


                  /* Optional GlideRecord */ event) {




email.setFrom(current.u_communication_source.u_newfrom);


email.setReplyTo(current.u_communication_source.u_newfrom);




})(current, template, email, email_action, event);



And simply put this in the Message field of the Notification:


${mail_script:u_commsource_from}