Can i fetch incidents whose previous or current assignment group as XXXX?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2024 03:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2024 04:04 AM - edited ‎10-09-2024 07:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2024 04:20 AM - edited ‎10-09-2024 04:22 AM
Hi @Sayali_9822,
To check for any past values in any field, you can utilize 'sys_audit' table.
You can use a function like this to check for Assignment Group match in the records:
getIncidents('YOUR_ASSIGNMENT_GROUP_SYS_ID');
function getIncidents(assignmentGroupID) {
var incidentIDs = [];
var audits = new GlideRecord('sys_audit');
audits.addEncodedQuery('tablename=incident^fieldname=assignment_group^newvalue=' + assignmentGroupID);
audits.query();
while (audits.next()) {
incidentIDs.push(audits.documentkey.toString());
}
return incidentIDs.toString();
}
Note: 'sys_audit' stores huge number of records for all type of audit updates. So, your query might take some time to process.
I hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2024 06:54 AM
Do i need to create client script or something for this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2024 07:17 AM
Can you please share more details on what you're planning to do after fetching those incidents?
I've shared a generic script which can be placed in a Script Include function that returns the sys_id of those incident records.