- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2017 07:52 AM
Hi All,
i have a requirement that i need to create a "info icon" beside the 'contact' field,
at the time of clicking the icon it need to display total count of incidents, problems, changes for that person(who is available in contact field),
at the time of clicking it need to display like this...
please help me how to create,..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 03:45 AM
Hi Venkatesh,
Because the script, which I have provided, is not taking the query which is Active or not. Please find the modified UI Macro script below in bold. Request you to set your quesry as per your requirement and give it a try.
<?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_RITMs_${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}" field="${ref}"
onclick="showRelatedRecordList('${ref}'); "
title="${gs.getMessage('Show related Records')}" image="images/icons/tasks.gifx"/>
<script>
// show related list
function showRelatedRecordList(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 ='sys_class_name=incident^ORsys_class_name=problem^ORsys_class_name=change_request^active=true' + referenceField + '=' + g_form.getValue(reference);
var gdw = new GlideModal('show_list');
gdw.setTitle(title);
gdw.setSize(750);
gdw.setPreference('table', 'task_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>
I hope this helps.Please mark correct/helpful based on impact

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2017 12:37 PM
Hi Venkat,
You can create a UI macro and set it as an attribute in your contact field.
ex, incident caller field, user_show_incidents is a UI macro, which displays all the incident created by that user.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 05:27 AM
Hi Venkatesh,
Please create a new UI Macro as of below and call the UI Macro in your Reference type field as the Attribute as 'ref_contributions=user_related_records'.
<?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_RITMs_${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}" field="${ref}"
onclick="showRelatedRecordList('${ref}'); "
title="${gs.getMessage('Show related Records')}" image="images/icons/tasks.gifx"/>
<script>
// show related list
function showRelatedRecordList(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 ='sys_class_name=incident^ORsys_class_name=problem^ORsys_class_name=change_request' + referenceField + '=' + g_form.getValue(reference);
var gdw = new GlideModal('show_list');
gdw.setTitle(title);
gdw.setSize(750);
gdw.setPreference('table', 'task_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>
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 03:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 03:22 AM
Hi Venkatesh,
Did you try the Script which I have provided in my last response? I guess, the UI Macro does populate all the task records based on the sys_class of the records (i.e., incident, problem, change_request) based upon the selected user in the field. But to my knowledge the result won't be set as GroupedBy. We can only set few limited methods in new Dialogue window. Please have a look at section 2 here: GlideDialogWindow API Reference - ServiceNow Wiki
I have crossed check that in my instance and is working totally fine, have a look at the below snapshot. Please let me know id you have any issue implementing the same.
I hope this helps.Please mark correct/helpful based on impact