- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2017 11:47 PM
Hi,
I am trying to pass the URL to clipboard by using the attached code in client script, but it works in IE browser and not for Chrome. Could you please suggest what change I can do on this code for working in Chrome browser?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2017 09:37 PM
Hi there,
I have tested the following code in IE 11, Chrome 62, and Firefox Quantum 57.
function onSubmit() {
var instanceName = "something";
var incidentURL = 'https://' + instanceName + '.service-now.com/incident.do?sys_id=' + g_form.getUniqueValue();
copyToClipboard(incidentURL);
}
ServiceNow provide this "copyToClipboard" function that can be used, which will cause the "Copied to clipboard" message within servicenow.
You could also use the code located on this PasteBin to accomplish the same thing silently. function onSubmit() { var instanceName = "something"; var incidentURL - Pastebin.com
Setup in Client Script as follows:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2017 09:37 PM
Hi there,
I have tested the following code in IE 11, Chrome 62, and Firefox Quantum 57.
function onSubmit() {
var instanceName = "something";
var incidentURL = 'https://' + instanceName + '.service-now.com/incident.do?sys_id=' + g_form.getUniqueValue();
copyToClipboard(incidentURL);
}
ServiceNow provide this "copyToClipboard" function that can be used, which will cause the "Copied to clipboard" message within servicenow.
You could also use the code located on this PasteBin to accomplish the same thing silently. function onSubmit() { var instanceName = "something"; var incidentURL - Pastebin.com
Setup in Client Script as follows:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2017 08:38 PM
Thanks for the help Domenic, it worked like a charm…..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2019 02:17 AM
HI,
This copyToClipboard() function is not working in Agent Workspace view. I can get the URL using "parent.location.href;" but cannot copy it to clipboard. Any workaround?
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2021 09:18 AM
I know I'm a bit late, but this can be done using
navigator.clipboard.writeText("You just copied me");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2018 11:36 PM
Hi team,
Any idea how to use this in Service portal ?