logo

NJP

Service-Now – Microsoft Teams Integration

Import · Oct 15, 2019 · article

Service-Now – Microsoft Teams

Follow below steps to integrate Snow with Teams for popup chat :

  1. Add team icon image to images.

image

image

  1. Now we must call UI macros on Caller ID field:

image

Add popup_chat in Caller ID field attribute as shown below:

image

  1. Now create a popup_chat UI macro

image

image

Now here is the important part which is UI Script:

<?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 = 'https://teams.microsoft.com/l/chat/0/0?users='+email;


var w = getTopWindow();

w.open(url);

}

</script>

</j:jelly>

In this code there is Teams Deeplink given by Teams that we must include.

https://teams.microsoft.com/l/chat/0/0?users='+email;

That’s all guys you will see Teams Icon on Caller ID field as below:

image

Now whenever you will select the Caller ID and click on Teams icon it will redirect to teams chat for selected user .

Please like , share, subscribe to this article.

In case of improvements please suggest me in comments.

Regards,

Ajay Chavan

+91-9769949577

India

View original source

https://www.servicenow.com/community/itsm-articles/service-now-microsoft-teams-integration/ta-p/2301655