Fix Script to update all the existing RITMs Closed date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 03:57 AM
Hi Team,
On requested items table records are closed complete but still closed date is not populated.
How can I write fix script to update all the existing records closed date by using updated date?
Please help me by providing your answer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 04:03 AM - edited 02-22-2024 04:03 AM
Hi,
Try this
var records = new GlideRecord('sc_req_item');
records.addQuery('state', 'closed_complete');
records.addQuery('closed_at ', '');
records.setWorkflow(false);
records.query();
while (records.next()) {
records.closed_at = records.sys_updated_on;
records.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 04:07 AM
Thanks @Anurag Tripathi , But sys_updated_on fetching created on date not updated on date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 04:09 AM
How is that possible? Can you show a screenshot with RITM with created and updated fields and what you see when you run the script I gave.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 12:39 AM
Actually I got confused with dates it is populating updated date, But actually I want to update closed date by fetching ritms closed complete date and time.
That how can I do any idea do you have?