Flow - how to get the previous assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 05:20 AM
Hi,
am new to flow designer tool .As part of my req. i need to create a flow and which is incident metric table and
all the opened tkts from JAN 01 2023 and if the ticket is coming from a different Assignment group - say Group1 , Group2 etc. i need to redirect to that particular Group , from where it came.
Can anyone please let me know, what flow logic i need to write it here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 05:24 AM
Hi @PrasadWT ,
Hope you are doing great.
- Add a trigger to initiate the flow. In this case, the trigger can be a scheduled trigger that runs daily or at a specified interval.
- Add a query action to fetch the opened tickets from the Incident Metric table. You can use the GlideAggregate API to construct the query and retrieve the required records.
var ga = new GlideAggregate('incident_metric');
ga.addQuery('opened_at', '>=', '2023-01-01');
ga.addQuery('state', '=', '1'); // Assuming '1' represents the 'Opened' state
ga.query();
while (ga.next()) {
var assignmentGroup = ga.getValue('assignment_group');
var ticketNumber = ga.getValue('number');
// Add further logic here to handle redirection based on assignment group
}
- loop through each record and check if it belongs to a different Assignment Group. if yes, then update the incident with previous assignment group.
var incidentGR = new GlideRecord('incident');
if (incidentGR.get('number', ticketNumber)) {
if (incidentGR.getValue('assignment_group') != assignmentGroup) {
incidentGR.setValue('assignment_group', assignmentGroup);
incidentGR.update();
}
}
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 10:07 AM
thanks much @Riya Verma for the code, am testing the same. Will update here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 07:08 AM
Currently we are not getting any data from incident_metric table.
is there any other tales, from which we can get results? also, am using FLOW Designer to implement this functionality.
so, if there is any in FLOW Designer logic to get the previous assignment group ?
if my previous group name is Group1 and my actual group name Group2.
i wanna get the Group1 using the flow designer.