The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Adding custom signatures in email notification script

Dubz
Mega Sage

Hi All,

I'm trying to add custom notifications for each of the companies in our group. I've got various if statements running in the notification script identifying when you send what but i'm trying to send a signature that i have stored in a script field in a custom table.

The logic looks like this:

if(condition1){

var gr = new GlideRecord('custom_table');

gr.addQuery('field', value);

gr.query();

if(gr.next()){

var signature = gr.u_signature.getValue()   //this is the script field in my custom table that holds the signature

//i don't know how to return this value into the body of the email

//template.print(signature)...?

//return signature...?

//everything i've tried so far just copies template.print('') multiple times.

for clarity the signature looks like a more complex version of:

template.print('<p><font size="3" color="#030000" face="arial">');

template.print('Tech Support');

template.print('</font></p>');

template.print('<img src="logo.png" width="154" height="90"/>');

Assistance would be great!

1 ACCEPTED SOLUTION

OK fixed it. I was trying to insert lines into the script rather than just content into the notification (if that makes sense). To that end i had prefixed every line in my custom table with template.print(). I took all those out and it's printing it properly now with template.print(signature);


View solution in original post

7 REPLIES 7

Lakshmaiah Dump
Giga Expert

Hi David,



1. Notification Email Scripts:



Create a Notification Email Scripts like,



if(condition1){


    var gr = new GlideRecord('custom_table');


                gr.addQuery('field', value);


                gr.query();


      if(gr.next()){


              var signature = gr.getValue('u_signature');


              template.print(signature);


      }



2. Create Notifications:



Call the Notification email script which you created above.



Syntax for calling the email script is : ${mail_script:mail_script_name}



Note: No space between mail_script and mail_script_name.



Hit Like/Helpful as when felt


@Lakshmaiah


HI Lakshmaiah,



Thanks but i know how to call the mail script, the problem is getting the content of the signature variable to display correctly.



If i add the signature lines directly to the mail script it displays them correctly, i want to store them in a record in a custom table and call them from a glide record.



If i write template.print(signature) it will put the signature lines in that template print eg: template.print('template.print('<p><font size="3" color="#030000" face="arial">');template.print('Tech Support');template.print('</font></p>');template.print('<img src="logo.png" width="154" height="90"/>');')



if i write return signature it doesn't append any signature at all.


Lakshmaiah Dump
Giga Expert

Hi David,



Use your custom table column name (u_signature) type is like HTML or Translated HTML.



Hit Like/Helpful as when felt


@Lakshmaiah


Yes, i am using the column name but i can't figure out how to return its value in the mail script.