- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 10-15-2019 12:46 AM
Service-Now – Microsoft Teams
Follow below steps to integrate Snow with Teams for popup chat :
- Add team icon image to images.
- Now we must call UI macros on Caller ID field:
Add popup_chat in Caller ID field attribute as shown below:
- Now create a popup_chat UI macro
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:
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
- 24,165 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Could you please help on this ?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi , i am also facing the same issue . The redirection from the servicenow to MS teams is working but it is redirecting to the latest user in the chat and not the correct user
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi All,
How can we show the below teams icon or making that UI macro visible to the ITIL users only?
Thank you!!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi All,
How can we open the MS Teams chat window that UI Macro from the UI Action Button please or How can we make the below code work in UI Action please?
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core"
xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<a class="btn-default;" id="${jvar_n}" onclick="invokeChat('${ref}');">
<img src="teams.png" width="30" title="Teams Chat" alt="${gs.getMessage('Click to open Teams chat')}" />
</a>
<script>
function invokeChat(reference) {
var prefix = 'msteams:/l/chat/0/0?users=';
var firstname = g_form.getReference('caller_id').first_name;
var user = g_form.getReference('caller_id').email;
var subject = '&amp;message=Hi ' + firstname + ', this is regarding your Incident (' + g_form.getValue('number') + ') ' + g_form.getValue('short_description');
var w = getTopWindow();
var url = prefix + user + subject;
w.open(url);
}
</script></j:jelly>
Thank you!!

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I'm able to open teams chat from ServiceNow for user that I have chat already created but not for any new
user. I get below error. What am I missing here
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I might be bit late on this post, but has same requirement so:
@arnabbhaumik You can add subject in your code by getting the ticket number and short description of recrd and then pass the same in url.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<a class="btn-default;" id="${jvar_n}" onclick="userWindow('${ref}');">
<img src="teams.jpg" width="25%" height="25%" title="Teams Chat" alt="${gs.getMessage('Click to open Teams Chat')}"/>
</a>
<script>
function userWindow(reference){
var prefix = 'https://teams.microsoft.com/l/chat/0/0?users=';
var refVal = reference.split('.');
var fieldName = refVal[1];
var emailId;
var fName;
var subject;
var sysId = g_form.getValue(fieldName);
var usr = new GlideRecord('sys_user');
if(usr.get(sysId)){
emailId = usr.email.toString();
fName= usr.first_name.toString();
subject = '&amp;message=Hi ' + fName + ', this is regarding your Case ' + g_form.getValue('number') + ': ' + g_form.getValue('short_description');
//g_form.addInfoMessage(emailId+' '+fName+' '+'Subject: '+subject);
}
if(emailId){
var w = getTopWindow();
var url = prefix + emailId + subject;
w.open(url);
//w.open(url,'_blank');
//open('sip:'+emailId, '_top');
}else{
g_form.addErrorMessage('User's email is empty');
}
}
</script>
</j:jelly>
Please mark helpful if this fulfills your requirement.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
In Teams message is correctly populating to the user. But it is copying to the next chat as well along with the required user chat. Please let me know how to resolve this issue.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Ajay_Chavan , wonderful article, thanks so much for the work!!
- « Previous
-
- 1
- 2
- Next »