@@ -35,60 +35,3 @@ Efficiently update multiple records in batch with error handling, progress track
35353 . Schedule for off-peak hours
36364 . Logs will be available in System Logs
3737
38- ## Example Usage
39- ``` javascript
40- // Customize these variables:
41- var TABLE = ' incident' ;
42- var FILTER = " priority=1^state=2" ; // Your query condition
43- var BATCH_SIZE = 100 ;
44- var FIELD_TO_UPDATE = ' assignment_group' ; // Field to update
45- var NEW_VALUE = ' 123456789abc' ; // New value
46-
47- // Run the script - it handles everything else
48- ```
49-
50- ## Key Features
51- - ** Batch Processing** : Prevents timeout by processing records in chunks
52- - ** Error Resilience** : Continues on error, logs details
53- - ** Progress Tracking** : Logs every N records updated
54- - ** Flexible** : Works with any table and field
55- - ** Safe** : Won't crash on individual record failures
56- - ** Auditable** : Detailed logging of all operations
57-
58- ## Output Examples
59- ```
60- [Bulk Update Started] Processing incidents with filter: priority=1
61- [Progress] Updated 100 records successfully (5 errors)
62- [Progress] Updated 200 records successfully (8 errors)
63- [Bulk Update Complete] Total: 250 | Success: 242 | Errors: 8
64- [Failed Records] 7af24b9c: User already has assignment
65- [Failed Records] 8bd35c8d: Invalid assignment group
66- ```
67-
68- ## Performance Notes
69- - Batch size of 100 is optimal for most tables
70- - Adjust batch size based on available resources
71- - Run during maintenance windows for large updates
72- - Monitor system logs during execution
73-
74- ## Customization
75- ``` javascript
76- // Change batch size for your table size
77- var BATCH_SIZE = 50 ; // For smaller batches
78- var BATCH_SIZE = 200 ; // For larger tables
79-
80- // Different field update logic
81- record .setValue (FIELD_TO_UPDATE , NEW_VALUE );
82- // Or use gs.getProperty() for configuration
83- ```
84-
85- ## Requirements
86- - ServiceNow instance
87- - Access to Background Scripts or Scheduled Jobs
88- - Write access to target table
89- - Appropriate table and field permissions
90-
91- ## Related APIs
92- - [ GlideRecord Query API] ( https://docs.servicenow.com/bundle/sandiego-application-development/page/app-store/dev_apps/concept/c_UsingGlideRecord.html )
93- - [ GlideSystem Logging] ( https://docs.servicenow.com/bundle/sandiego-application-development/page/app-store/dev_apps/concept/c_SystemLog.html )
94- - [ Best Practices for Bulk Operations] ( https://docs.servicenow.com/bundle/sandiego-application-development/page/app-store/dev_apps/concept/c_BulkOperations.html )
0 commit comments