---
original_url: "https://jace.pro/blog/call-user-via-teams/"
format: markdown
ai_optimized: true
---

Call User via Teams- # Call User via Teams

November 17, 2022 [servicenow ](/tags/servicenow/)[ui-macros](/tags/ui-macros/)

  Enable AI AnimationAjay Chavan wrote up a post about Adding
a Teams link to the user form and I thought
it was great. So I’m sharing it here with
my spin on it… Here’s [his post about it though](https://www.servicenow.com/community/it-service-management-articles/service-now-microsoft-teams-integration/ta-p/2301655).

## [UI16/Next Experience](#ui16/next-experience)

Download a teams icon, I got mine [here](https://statics.teams.cdn.live.net/hashed/favicon/prod/favicon-32x32-4102f07.png)

- Upload the image to System UI > Images with a name of “teams.png”

- Create a UI Macro called `incident_caller_teams_button`.

`<?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="ref-button btn btn-default btn-ref" 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 tableAndField = reference.split('.');
  var table = tableAndField[0]
  var field = tableAndField[1]
  var userSysId = g_form.getValue(field);
  var email;
  var sysUser = new GlideRecord('sys_user');
  if (sysUser.get(userSysId)) {
    email = sysUser.getValue('email');
    var teamsLink = 'https://teams.microsoft.com/l/chat/0/0?users=' + email;
    var w = getTopWindow();
    w.open(teamsLink);
  }
}
  </script>
</j:jelly>`
- From the list view of the macro set the Media Type[`media_type`] to `doctype`

- Update the Caller ID’s attributes to include the macros name as a ref_contribution like so;`ref_contributions=user_show_incidents;incident_caller_teams_button`

- Upload an attachment called teams.png with the teams logo.

---
[View this page on GitHub](https://github.com/jacebenson/jace.pro/tree/main/./src/posts/2022/2022-11-16-call-user-via-teams.md).

[Call User via Teams](https://jace.pro/blog/call-user-via-teams/) [Jace Benson](https://jace.pro) ![Jace Benson](https://jace.pro/icon-512x512.png)

---

*This content is from Jace Benson's ServiceNow and tech blog at jace.pro*
*Original post: https://jace.pro/blog/call-user-via-teams/*
