The CreatorCon Call for Content is officially open! Get started here.

How to create an icon next to a caller field which displays caller information in incident form

Muffin
Tera Contributor

Need to create an icon next to a caller field in the incident form and it should display the details of a caller

14 REPLIES 14

Prateek kumar
Mega Sage

This should help you oput.

https://docs.servicenow.com/bundle/newyork-platform-administration/page/administer/field-administrat...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Ajay_Chavan
Kilo Sage

you can achieve this using UI macro

Glad I could help! If this solved your issue, please mark it as ✅ Helpful and ✅ Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****

I tried and its showing the related caller information. Please tell me whether the below code is correct.

 

<?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="sys_user${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}" field="${ref}"
onclick="showCaller_Id('${ref}'); "
title="${gs.getMessage('Preview Caller Record')}" image="images/icons/tasks.gifx" icon="icon-user-selected"/>

<script>
// show related list
function showCaller_Id(reference) {
try {
var displayValue = g_form.getDisplayBox(reference).value;
var title = 'Preview Caller Record: ' + displayValue;
var s = reference.split('.');
var referenceField = s[s.length - 1];
var query = referenceField + '=' + g_form.getValue(reference);

var gdw = new GlideModal('sys_user');
gdw.setTitle(title);
gdw.setSize(750);
gdw.setPreference('focusTrap', true);
gdw.setPreference('table', 'sys_user');
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>

Hi Muffin,

 

i have tested this code, it works perfectly fine:

refer below SS:

 

find_real_file.png

 

 

If this resolves your query, please mark my comments as correct  and helpful  .

Regards,

Ajay Chavan

My Community Articles

LinkedIn

Glad I could help! If this solved your issue, please mark it as ✅ Helpful and ✅ Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****