Copy URL to clipboard

sylvain_hauser
Tera Contributor

I am looking for the code of the "Copy URL to clipboard" UI Actions, but I didn't find it in the list of the UI actions.

In fact, I would like to duplicate it and change the code in order to use to copy/paste the content of a knowledge article (to be able to export it to an other software).

Anyone knows how to duplicate this UI action?

2 REPLIES 2

CapaJC
ServiceNow Employee
ServiceNow Employee

The one for a form is not a UI Action, rather it's in the context_form_header UI Macro.

It uses a copyToClipboard(str) function which takes a string parameter as the content to copy to the clipboard.


CapaJC
ServiceNow Employee
ServiceNow Employee

copyToClipboard(str) does the following on the client:

function copyToClipboard(str) {
if (ie5) {
var textArea = document.createElement("textarea");
textArea.value = str;
var CopiedText = textArea.createTextRange();
CopiedText.execCommand("copy");
} else {
foxCopy_clip(str);
}
}