Convert double quotes into the string in email script.

Siddhesh Wani1
Tera Guru

In email notification script, passing the Universal request short description into the Subject of the Email, but some short description's contain double quotes, after the double quotes script neglect the remaining short description. I want to convert double quotes into the string so Subject will contain complete short description.

 

Email notification script :- 

 

var button1 = '<a href="mailto: ' + gs.getProperty('glide.email.user.reopen') + '?subject=Re: ' + current.number + ' | ' + current.short_description + ' | close my ticket&amp;body=Thanks! You can close my ticket."><img src="UniversalButton1.png" width="180" height="91"/></a>&nbsp;&nbsp;';
template.print(button1);

var button2 = '<a href="mailto: ' + gs.getProperty('glide.email.user.reopen') + '?subject=Re: ' + current.number + ' | ' + current.short_description + ' | ReOpen&amp;body=------ Please describe why the solution is not satisfactory for you ------"><img src="UniversalButton2.png" width="180" height="91"/></a>&nbsp&nbsp';
template.print(button2);

 

I attempted current.short_description.toString() this also not wotking. 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Siddhesh Wani1 

try this

var button1 = '<a href="mailto: ' + gs.getProperty('glide.email.user.reopen') + '?subject=Re: ' + current.number + ' | ' + encodeURIComponent(current.short_description) + ' | close my ticket&amp;body=Thanks! You can close my ticket."><img src="UniversalButton1.png" width="180" height="91"/></a>&nbsp;&nbsp;';
template.print(button1);

var button2 = '<a href="mailto: ' + gs.getProperty('glide.email.user.reopen') + '?subject=Re: ' + current.number + ' | ' + encodeURIComponent(current.short_description) + ' | ReOpen&amp;body=------ Please describe why the solution is not satisfactory for you ------"><img src="UniversalButton2.png" width="180" height="91"/></a>&nbsp&nbsp';
template.print(button2);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Siddhesh Wani1 

try this

var button1 = '<a href="mailto: ' + gs.getProperty('glide.email.user.reopen') + '?subject=Re: ' + current.number + ' | ' + encodeURIComponent(current.short_description) + ' | close my ticket&amp;body=Thanks! You can close my ticket."><img src="UniversalButton1.png" width="180" height="91"/></a>&nbsp;&nbsp;';
template.print(button1);

var button2 = '<a href="mailto: ' + gs.getProperty('glide.email.user.reopen') + '?subject=Re: ' + current.number + ' | ' + encodeURIComponent(current.short_description) + ' | ReOpen&amp;body=------ Please describe why the solution is not satisfactory for you ------"><img src="UniversalButton2.png" width="180" height="91"/></a>&nbsp&nbsp';
template.print(button2);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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