UI Action - Copy certain fields to the clipboard

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I'm looking to create a UI Action that copies certain fields on the form to the person's clipboard. Does anyone have any experience creating something like this?

Brad

1 ACCEPTED SOLUTION

Hi Ryan,



Different browsers handle this differently and it can be a security issue, so I've used some client code like this in the past.



var field = g_form.getValue('fieldname');


window.prompt("Copy to clipboard: Ctrl+C, Enter", field);



It pops up a window with the text for the user to copy. You could stick that code in a client side ui action.


View solution in original post

4 REPLIES 4

ryan_dinwiddie
Kilo Expert

Brad Tilton (Cloud Sherpas) did you ever find an answer to this? I just had a user ask for the same thing...


Hi Ryan,



Different browsers handle this differently and it can be a security issue, so I've used some client code like this in the past.



var field = g_form.getValue('fieldname');


window.prompt("Copy to clipboard: Ctrl+C, Enter", field);



It pops up a window with the text for the user to copy. You could stick that code in a client side ui action.


Great, thanks Brad!


annemariesintja
Kilo Expert

Be aware that from Madrid, in new client-scripts the window object is by default disabled.

 

find_real_file.png