Notifications

47 views

Description

This article explains on how to unescape special characters when passing dot walked value to a GlideRecord.

 

Release or Environment

Newyork

Instructions

Consider an example where the kb_knowledge_base has a special character in its name and we need to query all the articles where this name is set in the kb article(kb_knowledge) record in a string field.


unescape
   var gr = new GlideRecord("kb_knowledge_base");
   gr.get('SYS_ID');
   gr;


   var kb = new GlideRecord("kb_knowledge");
   kb.addQuery('topic', GlideStringUtil.unEscapeHTML('${topic.name}'.toString()));
   kb;

To note : Using GlideStringUtil.unEscapeHTML(JELLY_VARIABLE.toString()) will unescape the sepcial characters in the variable.

Additional Information

Consider an example where the kb_knowledge_base has a special character in its name and we need to query all the articles where this name is set in the kb article(kb_knowledge) record in a string field.



   var gr = new GlideRecord("kb_knowledge_base");
   gr.get('SYS_ID');
   gr;


   var kb = new GlideRecord("kb_knowledge");
   kb.addQuery('topic', GlideStringUtil.unEscapeHTML('${topic.name}'.toString()));
   kb;

To note : Using GlideStringUtil.unEscapeHTML(JELLY_VARIABLE.toString()) will unescape the special characters in the variable.

Article Information

Last Updated:2020-01-07 00:07:07
Published:2020-01-07