Delete condition of decision table records whose answers field value is same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hi All,
In the Decisions table, there are thousands of records. Many of these records have the same answer and the same condition (for example, changerequest.location).
If multiple records share the same answer and the same location condition, then the changerequest.state condition should be removed, and only one record should remain active. All other duplicate records should be marked as inactive. Attached pictures for the same scenario .
If any records contain all three conditions (changerequest.state = new, assess, or scheduled), those records should be deleted. For example below picture matches to this scenerio.
Is it possible to do so or will have to handle manually ? Please let me know if you need more info about it .
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hi @1_DipikaD
May you try via background script
var gr = new GlideRecord('x_your_decision_table');
gr.addQuery('changerequest_state', 'IN', 'new,assess,scheduled');
gr.query();
while (gr.next()) {
gs.info("Deleting record sys_id=" + gr.getUniqueValue() + " with state=" + gr.changerequest_state);
gr.deleteRecord();
}