Copy SysIds in Bulk

Deepak Negi
Mega Sage
Mega Sage

Did you ever get any use case where you need to copy SysIDs in bulk from a list view.

Use Case: There is some matrix that you need to validate in your script. You need to store the sysids in a property. One option is to export the CSV with Sys id field using ?CSV&sysparm_default_export_fields=all method, then convert in comma-separated list.

 

Bulk SysIds.gif

 

 

I created a small utility to help copy the sysids from any list. You can download the Utility from here or follow the below steps

Copy SysIDs in Bulk — Share | ServiceNow Developers

 

  1. Navigate to System Definitions > UI Actions > Create New
  2. Give the Name of your choice e.g “Copy Bulk SysIDs”
  3. Select Table as “Global” so it is available on every list.
  4. Tick the Client and List choice field checkbox and call the function in the Onclick field
  5. Write the below code inside the function in the Script field.
var sysIds = g_list.getChecked();
copyToClipboard(sysIds);

Here is a snapshot of the UI Action

DeepakNegi_0-1692285840225.png

 

6. Save the UI Action and start using it 🙂

Happy Learning!

Thanks

Deepak

Follow me on LinkedIn

1 REPLY 1

amarcus21
Tera Contributor

This looks neat!!!