- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2020 02:01 AM
In a ui page , how can I access variables inside <g2:evaluate> in client script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2020 09:58 PM
you need to convert that to string
<g2:evaluate var="jvar_gr" object="true" jelly="true">
var sysparm_original = RP.getParameterValue('sysparm_original');
var sysparm_template_sysid = RP.getParameterValue('sysparm_template');
var arr = [];
var gr = new GlideRecord('sn_doc_html_template');
gr.addQuery("sys_id",sysparm_template_sysid);
gr.query();
if(gr.next())
{
gs.addInfoMessage(gr.name);
arr.push(gr.name.toString());
arr.push(gr.footnote.toString());
arr.push(gr.html_script_body.toString());
}
arr.toString();
</g2:evaluate>
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2020 09:54 AM
hi
How can I access data of array,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2020 09:58 PM
you need to convert that to string
<g2:evaluate var="jvar_gr" object="true" jelly="true">
var sysparm_original = RP.getParameterValue('sysparm_original');
var sysparm_template_sysid = RP.getParameterValue('sysparm_template');
var arr = [];
var gr = new GlideRecord('sn_doc_html_template');
gr.addQuery("sys_id",sysparm_template_sysid);
gr.query();
if(gr.next())
{
gs.addInfoMessage(gr.name);
arr.push(gr.name.toString());
arr.push(gr.footnote.toString());
arr.push(gr.html_script_body.toString());
}
arr.toString();
</g2:evaluate>
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2020 11:46 PM
Thanks for marking my response as helpful.
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2020 01:24 AM
Hi
As this is returing me a comma seperated string, but in my case name and html text can also have a comma, so it will be hard to segregate them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2020 01:32 AM
Hi,
you can join the array with some other special characters to separate them out
arr.join('^');
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader