UI Macro - Open teams and start populating message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2020 10:12 AM
Hi All,
I've added a UI macro with a Microsoft Teams icon next to our assigned_to field to open a teams chat for that user. I've been asked if when it opens it could start the chat message with:
'Hi' + assigned_to.first_name + 'this is in regards to ticket' + number + short_description.
Has anyone achieved this, we are using the desktop teams app.
current ui macro is:
<?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 id="${jvar_n}"
onclick="invokeChat('${ref}');"
name="${jvar_n}"
onmouseout="lockPopup(event)"
tabindex="0"
>
<img border="0" src="teams.png" width="28" height="28" title="${gs.getMessage('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 = 'sip:'+email;
//var w = getTopWindow();
//w.open(url);
window.location = url;
}
</script>
</j:jelly>
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2022 07:05 AM
Hi,
Wonder if you managed to solve the INC link issue?
Thank you,
Raz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2022 11:39 AM
I never got around to changing the link, but I would guess that it's a matter of doing an addition to the var message, to include the teams markup
[NAME](Link) <- Should work in teams.
E.g. This would be [Community](https://www.servicenow.com/community) link demo of the markup
in teams.
//CRFN