How to write the script to clear the data on particular import in user table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2024 08:25 AM
How to write the script to clear the data on particular data import in user table without deleting other user record?Can anyone give some solution for it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2024 08:53 AM - edited ‎11-29-2024 08:55 AM
Hi @Nithya Devi ,
1. Navigate to System Import Sets > Advanced > Import Sets in ServiceNow.Open the desired Import Set execution.
—In the Import Set Rows related list, review the data and identify the records that were inserted.
—Extract the corresponding User IDs from the imported records.
—-Navigate to the sys_user.LIST view. Filter the list using the extracted User IDs. Copy the query and paste in below encoded query script
var grUser = new GlideRecord('sys_user');
grUser.addQuery('encoded query here’);
grUser.query();
grUser.setLimit(10);
grUser.deleteMultiple();
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand