Teams Macro showing message Twice

SIVASANKARA
Tera Contributor

I have created UI Macro for teams integration it is working fine but whenever click the web teams app then it is showing message twice and whenever click the teams app then working fine

UI Macro 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">
<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 firstname = g_form.getReference('caller_id').first_name;
var user = g_form.getReference('caller_id').email;
var subject = '&amp;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>



2 REPLIES 2

Akash4
Kilo Sage
Kilo Sage

Hi Siva,

Here is a revised code:

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide">

<a class="btn-default" id="${jvar_n}" onclick="invokeChat('${ref}'); return false;">
<img src="teams.png" width="30" title="Teams Chat" alt="${gs.getMessage('Click to open Teams chat')}" />
</a>

<script>
function invokeChat(reference) {
var prefix = 'https://teams.microsoft.com/l/chat/0/0?users=';

g_form.getReference('caller_id', function(caller) {
var firstname = caller.first_name;
var user = caller.email;

var subject = '&message=Hi ' + firstname + ', this is regarding your Incident ' + g_form.getValue('number') + ': ' + g_form.getValue('short_description');

var url = prefix + user + subject;
var w = getTopWindow();
w.open(url, '_blank');
});
}
</script>
</j:jelly>

 

 

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

Hai @Akash4  I have tried with ur code but I have not Abel to save the code it is showing error message like below

The reference to entity message must be end with ; delimiter