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
‎06-02-2016 11:57 PM
Hi,
Thanks for sharing, But i am facing issues after implementation.
in dictionary attributes : ref_contributions=user_show_cis;user_show_incidents;
then I am getting two icons but both are redirecting to incident list.
if I am writing
in dictionary attributes : ref_contributions=user_show_incidents;user_show_cis;
then I am getting two icons but both are redirecting to CMDB CI's list.
Please help me on above issue.
Thanks,
Pritam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 09:27 AM - edited ‎06-18-2025 09:41 AM
So many missteps and errors on this post.
If you are having issues follow these simple steps:
1. Create a UI Macro
Set Name field to: match_cis
In the XML field paste the following code:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j2:set var="jvar_n" value="getUserAssets_${ref}"/>
<a id="${jvar_n}" onClick="getUserAssets()" title="Lookup user assets" alt="Add me" tabindex="0" class="btn btn-default icon-hardware"></a>
<script>
function getUserAssets() {
var refurl = reflistOpenUrl('incident.cmdb_ci', 'incident.cmdb_ci', 'cmdb_ci', 'cmdb_ci', 'null', 'false', '');
var url = 'assigned_to=' + g_form.getValue('caller_id');
var refurlquery = refurl + url;
popupOpenStandard(refurlquery, 'lookup');
}
</script>
</j:jelly>
Save the form. It will look something like below (not all code shown in image)
3. On the Incident form right-click the caller_id field and select 'Configure Dictionary'
4. In the Attibutes field paste the following
encode_utf8=false,ref_contributions= match_cis
Important ote: if you already have ref_contribution in the Attributes field simple type ; at the end of what is already there and and add match_cis
5. Test on incident form by populating Caller ID field with a user that has config items and you should see the new field decorator as below, click it and select any CI it will then populate the selected CI on the cmdb-ci field:
Hope that helps everyone avoid the confusion 🙂
Regards
Paul