How to Replicate copyToClipboard function with Custom Message instead of Copied to Clipboard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 11:28 PM
I have a requirement to put a custom message in the place of "Copied to Clipboard" when clicked on a share symbol(macro) in KB.
Message needs to be replaced with a message like "Link for the article is copied to memory"..
Could some one help..
Following is the link that has the macro:
https://YOURINSTANCE.service-now.com/nav_to.do?uri=%2Fsys_ui_macro.do%3Fsys_id%3D3783deb1d70031004792a1737e610391%26sysparm_record_target%3Dsys_ui_macro%26sysparm_record_row%3D1%26sysparm_record_rows%3D1%26sysparm_record_list%3DnameSTARTSWITHkb_view_common_footer_metadata_fields%255EORDERBYname
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2021 01:23 AM
As workaround added below two lines:
g_form.addInfoMessage('Copied to clipboard');
setTimeout(g_form.clearMessages, 3000);
instead of :
if (!messageMethod || messageMethod == 'GlideUI') {
var span = document.createElement('span');
span.setAttribute('data-type', 'info');
span.setAttribute('data-text', 'Copied to clipboard');
span.setAttribute('data-duration', '2500');
GlideUI.get().fire(new GlideUINotification({
xml: span
}));
}
Worked fine.