
Add the following code to the field's attributes: ref_auto_completer=AJAXTableCompleter,ref_contributions=<strong>teams_icon</strong>.
Also, create a UI Macro named teams_icon.
<?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}"/>
<a class="btn-default;" id="${jvar_n}" onclick="invokeChat('${ref}');">
<img src="teams.png" width="30" title="Popup Teams" alt="${gs.getMessage('Click to open Teams chat')}" />
</a>
<script>
function invokeChat(reference) {
var s = reference.split('.');
var tableName = s[0];
var referenceField = s[1];
var v = g_form.getValue(referenceField);
var email;
var gr = new GlideRecord('sys_user');
if (gr.get(v)) {
email = gr.email;
}
var url = 'im:' + email;
var w = getTopWindow();
w.open(url);
}
</script>
</j:jelly>
How do I add an icon next to a field in ServiceNow?
Working Code Edited question May 2, 2025
Sorry, you do not have permission to read comments.