UI Macro Reference Contribution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 10:29 AM
I have taken code from a UI macro on the Incident table that displays all related tickets to the User of that Incident and am trying to use it on a custom table to do the same thing. However on the new table when clicked it displays all Incident tickets in the system. Doesn't look like any query is applied. The original reference field name is "caller_id" from the incident table and on the new table it is just called "caller" so I am not sure if that is making a difference. Any help is appreciated.
<?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_guid" expression="gs.generateGUID(this);" />
<j:set var="jvar_n" value="show_incidents_${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}" field="${ref}"
onclick="showRelatedList('${ref}'); "
title="${gs.getMessage('Show related incidents')}" image="images/icons/tasks.gifx"/>
<script>
// show related list
function showRelatedList(reference) {
try {
var displayValue = g_form.getDisplayBox(reference).value;
var title = 'Showing records related to: ' + displayValue;
var s = reference.split('.');
var referenceField = s[s.length - 1];
var query = referenceField + '=' + g_form.getValue(reference);
var gdw = new GlideModal('show_list');
gdw.setTitle(title);
gdw.setSize(750);
gdw.setPreference('table', 'incident_list');
gdw.setPreference('sysparm_query', query);
gdw.setPreference('title', 'A New Title');
gdw.render();
} catch (e) {
jslog('error showing related list');
jslog(e);
}
}
</script>
</j:jelly>
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 10:38 AM
Hi Wade,
can you put an alert(query );
please add screen of alert here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 10:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 11:37 AM
Looking into it further, that sys id it's showing is the ID of the record and not the user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 11:40 AM
ISsuw with the these 3 lines
<j:set var="jvar_n" value="show_incidents_${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}" field="${ref}"
onclick="showRelatedList('${ref}'); "