The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
darius_koohmare
ServiceNow Employee
ServiceNow Employee

With ServiceNow, you will find yourself working with plenty of data - from users and assets, to incidents and tasks. In many cases, you will encounter situations where you need to conduct a bulk/mass update of your records, either defining a new value, or replacing old values.

Perhaps your incident categorization has added a few new values that you want to set for historical reporting. Or maybe you have imported a bulk amount of knowledge articles and want to move all of them into a proper KB. Whatever the use case, ServiceNow makes bulk/mass updates extremely simple. Small/Moderate updates are handled easily via the UI, while large datasets are best kept to scripts (examples at the end of this blog).

How to update multiple records

1. Navigate to the list view of the table whose records you want to update. Tip: Just type the tablename.list into the navigator, like incident.list, to quickly get to this view.

In this example, we want to replace all occurrences of a monitoring tool's alert with a human readable description. ServiceNow's Event Management would have this normalization/transformation built in - but for the sake of this example let's assume it's a manual integration set up by an admin.

2. Now, it is crucial to decide - will you be updating all records on that table, or only a subset? If your answer is only a subset, make sure to apply filters so that only the data you want to update remains. If you want to update all records in the table, simply skip to step 3, but be aware that very large data sets will take a long time. In our example, we will filter on incidents where the short description is a particular monitoring string.

bulk updates_step 2.png

3. Once you have the data you would like to update, right-click any column title in List v2 (or select the three-line icon in List v3) and select Update All. This will update all the current records that match the filter criteria. It will not update records outside of the filter criteria.

bulk updates_step 3-1.png

On the other hand, Update Selected will only update the currently checked records, which is useful for smaller, manually selected batches.

bulk updates_step 3-2.png

 

4. You will see a confirmation message indicating the number of records that will be updated. This number should match the number of records in the list view at time of conducting the update (post-filter). This is a quick way to validate that you are not accidentally overwriting more records than you expected!

bulk updates_step 4.png

5. You will now see a blank form view of the records you are attempting to update. Set any new values you desire here, as they will be set across all the selected records. If you are missing the field you want to update, right-click the record header, navigate to Form Design (or Form Layout), and move the missing field onto the form (default view). After the update you can remove the field.

bulk updates_step 5.png

 

Congratulations! Your records have been bulk/mass updated!

bulk updates_step 5 congrats.png

Note: To allow a user to conduct such a potentially impactful action, the list_updater role is required.

More information can be found in the ServiceNow Docs: Edit multiple records in a list using an editing form

 

Considerations when making updates to large data sets

Now, some of you may be more inclined to use a script due to a truly large data set size.

For these cases, consider using the GlideMultipleUpdate call, which you can see documented (although not formally supported) here: ServiceNow Tips and Tricks

 

For other cases, doing a simple while loop through a glide record query can be effective as well. Just replace incident with the table of your choice, and replace the gr.addQuery parameter with your desired filter. Then, in the while loop you can set the value of any of your fields using the g.field_name = 'value' syntax.

 

In addition, it is advised to add a sleep(); call between the update calls.

This will help improve overall system performance by preventing exhausting the DB with large SQL queries.

 

 

  • var gr = new GlideRecord('incident');  
  • gr.setLimit(100); //will update 100 records at a time
  • gr.addQuery('active', 'true');  
  • gr.query();  
  • while(gr.next())  
  •   {  
  •   gr.short_description = 'test';  
  •   gr.setWorkflow(false); //Will not fire BR/email notifications  
  •   gr.update();  
  •   }  
14 Comments