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.

Add next line in mail script

RudhraKAM
Tera Guru

Hello there 

I have a mail script where i am trying to add ----- and text in next line but its not working can some one help me with that 

I have a link up on clicking that it will open outlook with below text 


Re: Please reopen INC0239698 (email subject)
______________________
You can type a message before this text.
Please do not edit the Subject or remove the text below
Ref:MSG3004715

 

 

Mail script 

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

        
var url='<a href="mailto:' + gs.getProperty('glide.email.reopen.incident') + '?subject=Re: Please reopen'+current.number+ '&amp;body=You can type a message before this text. Please do not edit the Subject or remove the following text: , or the record will not reopen'+ email.watermark +'">'+ 'click here to reopen the incident' +'</a>';
	template.print(url);
	

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

1 ACCEPTED SOLUTION

SanjivMeher
Mega Patron
Mega Patron

All the email threads says using %0D%0A should work. Try the script I have provided below

 

https://stackoverflow.com/questions/10356329/mailto-link-multiple-body-lines

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Adding-Line-Break-into-Launch-quot-mailto-qu...

 

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

        
var url='<a href="mailto:' + gs.getProperty('glide.email.reopen.incident') + '?subject=Re: Please reopen'+current.number+ '&amp;body=You can type a message before this text. Please do not edit the Subject or remove the following text: , or the record will not reopen%0D%0A'+ email.watermark +'">'+ 'click here to reopen the incident' +'</a>';
	template.print(url);
	

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

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

4 REPLIES 4

MrMuhammad
Giga Sage

try this

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

        
var url='<a href="mailto:' + gs.getProperty('glide.email.reopen.incident') + '?subject=Re: Please reopen'+current.number+ '&amp;body=You can type a message before this text. Please do not edit the Subject or remove the following text: , or the record will not reopen'+ email.watermark +'">'+ 'click here to reopen the incident' +'</a>';
	template.print(url+"\n");
		template.print("------------------\n" + "You can type a message before this text.\nPlease do not edit the Subject or remove the text below");


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

SanjivMeher
Mega Patron
Mega Patron

All the email threads says using %0D%0A should work. Try the script I have provided below

 

https://stackoverflow.com/questions/10356329/mailto-link-multiple-body-lines

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Adding-Line-Break-into-Launch-quot-mailto-qu...

 

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

        
var url='<a href="mailto:' + gs.getProperty('glide.email.reopen.incident') + '?subject=Re: Please reopen'+current.number+ '&amp;body=You can type a message before this text. Please do not edit the Subject or remove the following text: , or the record will not reopen%0D%0A'+ email.watermark +'">'+ 'click here to reopen the incident' +'</a>';
	template.print(url);
	

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

Please mark this response as correct or helpful if it assisted you with your question.

ashribhagwat
Tera Contributor

Nice. It's working.