Font Style in Email Scripts

basantsoni
Kilo Guru

 

Hello Friends,

I have prepared some email notification emails that display some data, and some are hyperlinks. But font style and font size I want to add so that those email scripts also will be having same font style like notification email content.

Please help on this, I have stored all information from email notification into variables that are displaying information like:

template.print(PrintVa);

template.print(acknowledge_URL);

template.print(ref_notes);

thanks,

Basant Soni  

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Basant,

you can give the css inside template.print

https://community.servicenow.com/community?id=community_question&sys_id=e1aef5f0db3deb00f21f5583ca96...

https://community.servicenow.com/community?id=community_question&sys_id=cda403e9dbd8dbc01dcaf3231f96...

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sanket Khabiya
Kilo Sage

You can achieve this by writing below script in email script :

For eg.:

template.print('<p style="font-size:12px; color:#000000; font-family:arial"><strong>');
template.print(PrintVa);
template.print('</strong></p>');

 

Regards,

Sanket

basantsoni
Kilo Guru

Hello all,

Thanks for you response, but still issue did not resolve. I have applied provided style but it’s not changing font size and style. Only we want to change size and style as like other text.

Without knowing what you're trying to make it look like or how you're going about it, it's hard to get specific, but in general I'd look at an existing notification/script that does what you're trying to do and use that for guidance. If the styling is done in a mail script (as it is with almost all of the content in an Incident notification) then you can duplicate the style attributes in your own script -- or if you're just modifying the existing script, make sure you put your text above the </element> that terminates the styling (I just had to fix a script where a consultant had put the additional text below the </font></p> and it was using the default style). For examples of several different style applications done in a mail script, you can look at almost any of the ones triggered off Incident. Incident assigned to me is a good example, because all of the styling is done within the mail scripts in the body.

find_real_file.png

If the styling you're trying to use is in the message body itself, the "<>" (Source code) button can tell you a lot.  Examples are a little harder to come by for this, but I did find one called Change Survey that gives you something to start with:

find_real_file.png

Click the <> button and it shows you this pop-out:

find_real_file.png

I'll have to defer on what styling you can do with a template, but it seems like you could create CSS classes within that which might cause you a headache if you don't know they're there.  I don't know if this applies in your case, but it's worth looking into.  The same HTML editor is used for templates, so you have the same options as you would in a message body.

Good luck!