Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Can we add text color in email mail scripts?

kirthi1
Tera Contributor

I am trying to add color red to the text on the email script and not able to do it successfully. 

The below mail script is for the 'Resolved notification- I have a Reject Solution button and then when clicked on the 'Reject Solution' button the text comes from the 'href' in the body (highlighted in yellow).

I am not sure how to change the text color like this text Reject Reason: [type the reason you are rejecting the resolution] 

Any help is appreciated. please let me if there is an easy method.

find_real_file.png

 

 

10 REPLIES 10

try this

&body=<font color='red' size='100px'>Your message here</font>

also refer this link

Include html in mailto email template?

Regards
Ankur

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

@kirthi 

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

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

Can you share your complete code instead of screenshot?

I will correct your code to make it work.

 

 

 

Regards,

Sachin

Hi @sachin.namjoshi ,

Sorry for the delay, here is the code below-

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {

// Add your code here
(function(smtpAddress, watermark) {



var href = 'href="mailto:'+ 'dev98980@service-now.com' +'?subject=Re: ${number}%3A%20 reopen&amp;'+ 'body=Rejected. Please reopen the incident. %0A%0A*Reject Reason: [type the reason you are rejecting the resolution] %0A%0A%0A%0A%0A%0ADO NOT DELETE TEXT BELOW %0A%0A' + watermark + '"';

var anchor = '<a '+ href +'><img src="/rejectsolution.png" style="width:204;height:44" alt="RejectSolution" /></a>';

//var emailbod = "I approve this request.";
template.print(anchor);
// template.print('<p style="font-size:12px; color:#000000; font-family:arial"><strong>');
// template.print('body');
// template.print('</strong></p>');
//template.print('${number}');

 

})(gs.getProperty('glide.email.user'), email.watermark);


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

Hi,

can you try this

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {

// Add your code here
(function(smtpAddress, watermark) {



var href = 'href="mailto:'+ 'atxdev@service-now.com' +'?subject=Re: ${number}%3A%20 reopen&amp;'+ 'body=<font color='red' size='100px'>Rejected. Please reopen the incident. %0A%0A*Reject Reason: [type the reason you are rejecting the resolution] </font>%0A%0A%0A%0A%0A%0ADO NOT DELETE TEXT BELOW %0A%0A' + watermark + '"';

var anchor = '<a '+ href +'><img src="/rejectsolution.png" style="width:204;height:44" alt="RejectSolution" /></a>';

//var emailbod = "I approve this request.";
template.print(anchor);
// template.print('<p style="font-size:12px; color:#000000; font-family:arial"><strong>');
// template.print('body');
// template.print('</strong></p>');
//template.print('${number}');

 

})(gs.getProperty('glide.email.user'), email.watermark);


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

Regards
Ankur

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