Flow - how to get the previous assignment group

PrasadWT
Tera Contributor

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.

3 REPLIES 3

Riya Verma
Kilo Sage
Kilo Sage

Hi @PrasadWT ,

Hope you are doing great.

 

  1. 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.
  2. 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();
    }
}

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

thanks much @Riya Verma  for the code, am testing the same. Will update here.

PrasadWT
Tera Contributor

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.