Replies: 4 comments 2 replies
-
|
A /copylink slash command. What a great idea!
Sent from my iPhone ***@***.***)
On 4 Sep 2025, at 15:49, krysbzh ***@***.***> wrote:
Hello everyone,
I often need to send my colleagues the number of a Story or RITM in a MS Teams conversation. To make their lives easier, I convert the text into an HTTP link.
Until now, I'd copy and paste the number and add the hyperlink before sending my message. A lot of manipulation and time wasted.
So I came up with the idea of creating a slash command that prepares the link and stores it in the clipboard. I called it "/lk" and here's the code I added.
javascript:(async function(){try{var label=null;if(window.g_form){label=g_form.getValue('number');}if(!label){label=document.title;}var url=window.location.href;if(!label){alert('Impossible de déterminer un label');return;}var html='<a href=\"'+url+'\">'+label+'</a>';var text=label+' - '+url;await navigator.clipboard.write([new ClipboardItem({ 'text/html': new Blob([html], {type: 'text/html'}), 'text/plain': new Blob([text], {type: 'text/plain'}) })]);}catch(e){alert('Erreur : '+e);}})();
If the number field exists, it displays the number label; otherwise, it uses the page title. This doesn't work as well. I'll let you test it out, and if you have any comments or ideas for improvement, I'd be happy to share them.
Regards
Chris
—
Reply to this email directly, view it on GitHub<#610>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANLDHJXTKPWPKCKE3M6NODL3RBGQVAVCNFSM6AAAAACFUHW3WWVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZYHA2DANZVGQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Cool, thanks for sharing! Instead of alert, you could consider using |
Beta Was this translation helpful? Give feedback.
-
|
I just came here to see if anything like this had been attempted. Thanks for sharing. The only thing i would like to see added (which may not be possible in a slash command) is to include the value of the display field for the record. So for an incident, for example, you would get something like "INC001234 - User cannot log into Windows" with the link. |
Beta Was this translation helpful? Give feedback.
-
|
This is quite a useful addition to my list of custom ones! Is it possible to have the 'main URL' instead of the full URL encoded? eg. If I have navigated to a ticket manually, the URL includes all the parameters: It would be nice if this were reduced to the main URL only: Thanks!! |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I often need to send my colleagues the number of a Story or RITM in a MS Teams conversation. To make their lives easier, I convert the text into an HTTP link.
Until now, I'd copy and paste the number and add the hyperlink before sending my message. A lot of manipulation and time wasted.
So I came up with the idea of creating a slash command that prepares the link and stores it in the clipboard. I called it "/lk" and here's the code I added.
javascript: (async function () { try { var label = null; if (window.g_form) { label = g_form.getValue('number'); if(g_form.getValue('short_description')) label+=" | "+g_form.getValue('short_description');} if (!label) { label = document.title; } var url = window.location.href; if (!label) { alert('Impossible to get a label'); return; } var html = '<a href=\"' + url + '\">' + label + '</a>'; var text = label + ' - ' + url; await navigator.clipboard.write([new ClipboardItem({ 'text/html': new Blob([html], { type: 'text/html' }), 'text/plain': new Blob([text], { type: 'text/plain' }) })]); snuSlashCommandInfoText("Link to current page copied in clipboard !"); return; } catch (e) { alert('Erreur : ' + e); } })();If the number field exists, it displays the number label; otherwise, it uses the page title. This doesn't work as well. I'll let you test it out, and if you have any comments or ideas for improvement, I'd be happy to share them.
Regards
Chris
Beta Was this translation helpful? Give feedback.
All reactions