- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 03:16 AM
Hello,
I have created UI macro. This macro is running on the incident form and only find all notifications whose belong to current incident.
But I need the sys_id of the incident changes dynamicaly. Is any choice that this provides me? My code of UI macro is below this text.
Thank you.
<?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_emails" object="true">
var gr = new GlideRecord("sys_email");
gr.addQuery('instance', 'e8e875b0c0a80164009dc852b4d677d5');
gr.orderBy('sys_created_on');
gr.query();
gr;
</g:evaluate>
<table>
<tr>
<th>Email to</th>
<th>Subject</th>
<th>Date</th>
</tr>
<j:while test="${jvar_emails.next()}">
<tr>
<td>${HTML:jvar_emails.getValue('recipients')}</td>
<td>${HTML:jvar_emails.getValue('subject')}</td>
<td>${HTML:jvar_emails.getValue('sys_created_on')}</td>
</tr>
</j:while>
</table>
</j:jelly>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 04:30 AM
Hi Harel,
Thank you for your reply.
Yes I tried current.sys_id and g_form.getUniqueValue () and this was not working.
I configure the UI macro in the incident form where are the tabs (notes, related records ...) on this place I create a new tab and calls formatter that uses my UI macro.
But I solved it with parse URL, concrete I need sys_id from url. Code looks like this.
<g:evaluate var="sys_id">
var sys_id = RP.getParameterValue("sys_id");
sys_id;
</g:evaluate>
<g:evaluate var="jvar_emails" object="true" jelly="true">
var gr = new GlideRecord("sys_email");
gr.addQuery('instance', jelly.sys_id);
gr.orderBy('sys_created_on');
gr.query();
gr;
</g:evaluate>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 04:14 AM
Hi Petr,
Did you try current.sys_id or g_form.getUniqueValue()?
Also, where do you configure the ui macro on the form?
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 04:30 AM
Hi Harel,
Thank you for your reply.
Yes I tried current.sys_id and g_form.getUniqueValue () and this was not working.
I configure the UI macro in the incident form where are the tabs (notes, related records ...) on this place I create a new tab and calls formatter that uses my UI macro.
But I solved it with parse URL, concrete I need sys_id from url. Code looks like this.
<g:evaluate var="sys_id">
var sys_id = RP.getParameterValue("sys_id");
sys_id;
</g:evaluate>
<g:evaluate var="jvar_emails" object="true" jelly="true">
var gr = new GlideRecord("sys_email");
gr.addQuery('instance', jelly.sys_id);
gr.orderBy('sys_created_on');
gr.query();
gr;
</g:evaluate>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 04:41 AM
I am glad you figured it out.