UI Macro to popup a caller's CI list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2008 10:30 AM
I created this UI macro and thought it may be of use to others. It creates an icon next to the Caller field on the Incident form that will pop up a list of CI's that are assigned to the caller. It's very similar to the 'Show related incidents' pop up, in fact I just copied that UI macro as a starting point for this one.
In addition to creating the UI macro, you will also need to set the Attributes field on the incident.caller_id field to:
ref_contributions=user_show_incidents;user_show_assigned_ci
UI Macro
Name: user_show_assigned_ci
XML:
<?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="Packages.com.glide.util.Guid.generate(this);" />
<j:set var="jvar_n" value="show_cis_${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}"
field="${ref}"
onclick="showRelatedCIList('${ref}'); "
title="${gs.getMessage('Show related configuration items')}"
image="images/icons/cmbd_ci.gifx"/>
// show related list
function showRelatedCIList(reference) {
var s = reference.split('.');
var referenceField = s[1];
var v = g_form.getValue(referenceField);
var url = 'cmdb_ci_list.do?&sysparm_query=assigned_to=' + v;
var w = getTopWindow();
w.popupOpenFocus(url, 'related_list', 950, 700, '', false, false);
}
</j:jelly>
</xml>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2010 05:16 AM
Thanks! works great
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2011 07:08 AM
I am having a few issues getting this to work correctly. I modified this script to refer to a different database. When I added the new UI Macro to the incident form both buttons point me to my new database. Both UI Marcos work great when I just use 1 of them, but when I use both I have issues where they point to the same database. Here is what I have on my Attributes line: ref_auto_completer=AJAXTableCompleter,ref_ac_columns=location.u_site_code,ref_contributions=user_show_incidents;user_show_access_matrix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2011 07:58 AM
I found the problem. I removed 'CI' from showRelatedCIList. Once I put it back everything started working fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2012 11:52 AM
I too had to play around with this, but this worked for me. Alsoif you are using more than one reference in the attributes of your dictionary entry, separate them with semicolons, and you can only have one reference (ref_contributions=) like this:
ref_contributions=caller_show_incidents;caller_show_requests;user_show_assigned_ci
I also created the ref icons for related incidents, and related requests. Thanks to ServiceNow guru for these.
See attached txt file, as the full code seems to get truncated here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2012 09:10 AM
Hi all
I wanted to ask, how do the following lines in the code example work:
function showRelatedCIList(reference) {
var s = reference.split('.');
var referenceField = s[1];
I have not seen that s[1] notation elsewhere, how does it create a reference to the field.
Thanks