copy to clipboard and stay on site

fuzum
Kilo Contributor

Hi everyone,

I hope you guys can help me :S

I made a new UI-Action for the context menu. I need to copy information generated by a JS to the clipboard. I try it by using window.prompt("Copy to clipboard: Ctrl+C, Enter", someGeneratedText);.

My problem is, at first, the promt window doesn't show up. Also I want it to stay at the current page (it always jumps back to the previous page).

Kind Regards

7 REPLIES 7

Chuck Tomasi
Tera Patron

Can you share the UI Action script here?



Thank you


Thank you for your quick answer!


UI Action.JPG


OK, I think I see it - you have client side code (window.prompt) and server code together.



By default, UI actions run server code only unless you click the client checkbox, then you need to tell it which function to run on click, write your client code in that function, and optionally call the server code. Here's a good reference and example how to do that.



https://www.google.com/url?q=https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-se...


Thank you for your help Chuck. It worked out with the checkbox...somehow. Is it possible to call a script of script include in a (Client) UI Action??