The CreatorCon Call for Content is officially open! Get started here.

UI Macro - Open teams and start populating message

Sam Ogden
Tera Guru

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>
11 REPLIES 11

Hi,

Wonder if you managed to solve the INC link issue?

 

Thank you,

Raz

Community Alums
Not applicable

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