To generate and print labels for items that had an “&” symbol in the “Purchase Description” field, we can use escapeSpecialChar() function.
function escapeSpecialChar(textvalue) {
try {
textvalue = textvalue.replace(/&/g, '&');
textvalue = textvalue.replace(/</g, '<');
textvalue = textvalue.replace(/>/g, '>');
textvalue = textvalue.replace(/"/g, '');
textvalue = textvalue.replace(/'/g, '');
textvalue = textvalue.replaceAll("$", "");
return textvalue;
} catch (e) {
log.error({
title: e.name,
details: e
});
}
}
