logo

NJP

Update or Delete Bulk Records without Scripting

Import · Sep 15, 2022 · article

You all might have come across the requirement where you need to update or delete bulk records based on some conditions and you might have made use of Fix Script or Background Script. But are you aware of the possibility to achieve the same without scripting ?? Yes you guessed it right, it is possible through System Data Management available Tokyo release onwards.

At present System Data Management supports following jobs

  • Update Job
    Delete specific number of records from a table without using scripts by creating and executing delete jobs.
  • Delete Job
    Update specific number of records simultaneously without using scripts by creating and executing a batch update job.

Procedure to create Update Jobs:

Use Case : Update all active Incidents category to "Inquiry / Help" where Assignment group "Service Desk".

  1. .
  2. Create a new Update Job and Fill the form according your use case.
Table Select the Table that contains the records you want to update.
Run business rules and engines Setting Run business rules and engines to True enables and False disables the running of Business Rule. Run business rules and engines is same as using setWorkFlow(true/false) in Script.
Preview Select Preview to view the number of records that match the conditions & clicking on the link with the number will open all matching records.
Fields & values In the Fields & values lists, select the field that you want to update and a new value.
Condition Limit the number of records in the update job by adding a condition or conditions that records must meet. Select a field, operator, and field value.For example, [Category] [is] [Software].(Optional) Use the OR and AND operators to add conditions.(Optional) Select New Criteria to add another set of conditions.
Auto updating system fields Setting Auto updating system fields to True will update audit fields (such as sys_updated_by & sys_updated_by) and setting to False will suppress updating the fields.Auto updating system fields is same as using AutoSys Fields(true/false) in Script.

Note: Limiting the number of records that are added to the update job can help prevent the table from being locked when the job is executed.

image

  • Select Continue to save the record.
  • As soon as the job is saved the form provides options to schedule the job or Execute Now.
    Run at: Select the time to schedule the Update Job or you can run the Update Job during non-business hours to minimize the potential performance impact on your users.
    Execute Now: Clicking Execute Now will executethe job immediately.
  • Click on Execute Now to execute the Update Job.
    image
  • You can even rollback a completed Update Job to revert the updates to the records to do so click on Check execution results or
    image

image

Update Job Results:

Before Update Job Execution

image

After Update Job Execution

image

Procedure to create Delete Jobs:

Use Case : Delete all Incidents where Short Description contains Test keyword.

  1. .
  2. Create a new Job and Fill the form according your use case.
    image
  3. Select Continue to save the record.
  4. As soon as the job is saved similar to Update Job the form provides options to schedule the job or Execute Now along with Preview Cascade.
    Run at: Select the time to schedule the Update Job or you can run the Update Job during non-business hours to minimize the potential performance impact on your users.
    Preview Cascade: Clicking on Preview Cascade will displays the number cascade deletions by the table. [ I f a record in the parent table is deleted, then the corresponding records in the child table will automatically be deleted ]
    Execute Now: Clicking Execute Now will executethe job immediately.
    For example deleting all Incidents where Short Description contains Test keyword will also deletes the associated Task SLA records.
    image
  5. Click on Execute Now to execute the Delete Job.
  6. Similar to Update Job you can even rollback a completed Delete Job to revert the deleted records to do so click on Check execution results or
    Delete Job Results:Before Delete Job Execution
    image
    After Delete Job Execution
    image

Happy Learning !!!

image

View original source

https://www.servicenow.com/community/now-platform-articles/update-or-delete-bulk-records-without-scripting/ta-p/2322875