Copy text to clipboard
Recently, I had to create a Context Menu to copy some elements from a list to the clipboard.
ServiceNow does that OOTB in a few places, so no need to reinvent the wheel!
Let’s have a look at the UI Action “Copy sys_id”:
runContextAction();
function runContextAction() {
copyToClipboard(g_sysId);
}
Code language: JavaScript (javascript)
Pretty simple, right?
You just need to use the function “copyToClipboard” and pass the text you want to copy as a parameter.
If you are interested in having a look at the function definition, you can find the code in your instance:
https://<instance_name>.service-now.com/scripts/functions_clipboard.js
Code language: HTML, XML (xml)
Insert Widget in GlideModal
Have you ever tried to put a Portal Widget inside an iframe inside an UI Page inside a Pop Up… I swear I had no choice!
HTML Work notes/Comments in Agent Workspace
Having HTML fields for Work notes and Comments for Tasks.
I’ve seen that requirement a few times and I haven’t found the perfect solution yet.
But in the Agent Workspace, you just need to set a System Property:
glide.ui.journal.use_html
Code language: CSS (css)
Controls whether journal entries in workspace are displayed as html fields or string fields (true = html, false = string)