ui macro and current record information
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2016 10:53 AM
Thursday afternoon before a long weekend and I'd said I'd look at something for a colleague and now I regret it
We need to show the information from a "source" record, but the usual dot walking is doing some very odd things.- hi ticket logged
I said, "use something like a summarizer and do it yourself via a ui macro"
Well, in principle it is dead easy, but for some reason I am struggling to get the details of the current record across
In the "approval_summarizer_sc_request", there are the following lines
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<tr>
<td class="label_left" width="100%">
${gs.getMessage('Summary of Request being approved')}:
<g:label_spacing/>
</td>
</tr>
<g:evaluate var="jvar_total" expression="
var sc_request = ${ref}.sysapproval;
gs.log(sc_request);
when I look at an approval for a request, I see an entry in the log for the sys_id
From there it is dead easy to carry on and do what we need -we know as we have updated a couple of these.
I called this a new name and inserted it as a new ui macro
I have made a formatter linking to this new ui macro
I run it I see the text on the screen, but nothing in the log to show me the value from the field
(If I remove lines 12/13 I do see "are you there" in the logs
The code is
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<tr>
<td class="label_left" width="100%">
${gs.getMessage('Summary of tpip being approved')}:
<g:label_spacing/>
</td>
</tr>
<g:evaluate var="jvar_total" expression="
gs.log('are you there ?');
var sc_request = ${ref}.u_inherited_tpip_request;
gs.log(sc_request);
So my questions are
1. How do I pass the current record information to the script - If get this current ID I can get the field value I need
2. Better still,. how I do pass the value from the u_inherited_tpip_request
There is scarce info about ui_macro's and on the pages I do see for Jelly etc I do not see any real reference to ${ref}, but the examples do use it
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 12:44 PM
We ended up opening a ticket as well and our issue was solved. The trick for mine was running the UI Macro in Phase 2 (g2/j2) which you were doing in your sample. I just had to reference it via "current.field". Now i'm working to see if I can utilize GlideJellyRunner to invoke it from a client script (with ajax call) to have the UI Macro refresh on the form once a field changes. Hopefully this helps!
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g2:evaluate var="jvar_room" expression="
var room = current.u_conference_room;
room;
"/>
<g2:evaluate var="services" jelly="true" expression="
var my_services = [];
if (jelly.jvar_room != ''){
var serv1 = new GlideRecord('u_m2m_rooms_serv');
serv1.addQuery('u_room', jelly.jvar_room);
serv1.orderBy('u_service.u_service_type');
serv1.query();
while (serv1.next())
my_services.push(serv1.u_service.u_service_type.sys_id.toString());
}
var services = new GlideRecord('u_service_types');
if (my_services != '')
services.addEncodedQuery('sys_idIN' + my_services);
services.orderBy('u_name');
services.query();
"/>
<style>
.th {font-weight:normal;font-size:12px;}
</style>
<g2:ui_table>
<j2:if test="$[services.hasNext()]" >
<TR>
<TH vAlign="bottom" align="left">
Available Services
</TH>
</TR>
</j2:if>
<j2:while test="$[services.next()]">
<tr>
<td colspan="2">
<g:ui_spacer pixels="6"/>
<g:ui_checkbox name="service_$[services.sys_id]" id="service_$[services.sys_id]" class="checkbox_list_mechanic"/>
<label class="label_list_mechanic" for="service_$[services.sys_id]"> $[HTML:services.getDisplayValue()] </label>
</td>
</tr>
</j2:while>
</g2:ui_table>