The entity name must immediately follow the '&' in the entity reference" when we use "&

balajig
Kilo Contributor

We got a UI macro from online to invoke outlook from ServiceNow . We added the UI macro near the the requested for of the incident form . The script will add the requested for in the to address of the new Email and incident number and short description in the the subject of the Email and below is the script . Our requirement is to add our instance Email ID in the BCC when the new mail is created . So we updated the original line with a new line as given below . This is giving us an error The entity name must immediately follow the '&' in the entity reference" when we use "&  We were told to change the property glide.ui.escape_text to true but we will not be able to to because its causing problem with our HTML contents

//////////////////// Code Start //////////////////////////////

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core"
xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_guid" expression="gs.generateGUID(this);"/>
<j:set var="jvar_n" value="show_lync_${jvar_guid}:${ref}"/>
<span id="${jvar_n}"
field="${ref}"
onclick="invokeMail('${ref}');"
title="Send Email"
image="outlook.jpg">
<img src="outlook.jpg" width="25px" height="25px"/>
</span>
<script>
function invokeMail(reference){
var s = reference.split('.');
var tableName = s[0];
var referenceField = s[1];
var v = g_form.getValue(referenceField);
var gr = new GlideRecord('sys_user');
gr.setLimit(1);
gr.query();
var email;
if(gr.get(v)) {
email = gr.email;

// Original Line 

var url = "mailto:"+email+"?subject=RE: "+g_form.getValue('number')+" - "+g_form.getValue('short_description'); 

// New Line

var url = "mailto:"+email+"?bcc=abc@gmail.com &amp; subject=RE: "+g_form.getValue('number')+" - "+g_form.getValue('short_description');

var w = getTopWindow();
w.location = url;

} else {
alert('Please select valid user or atleast one user');
}
}
</script>
</j:jelly>

///////////////////////// Code End /////////////////////////////////////////////

 

  

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

You can use 

${AMP} instead of &
-Anurag

View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

You can use 

${AMP} instead of &
-Anurag

balajig
Kilo Contributor

Hi Anurag,

 

Thank you for your time and input . Its working .

 

Regards

Balaji G

cheers mate.

-Anurag