Creating a report to show Incidents without Interactions

SimonHind
Tera Contributor

I am trying to generate a report for the dashboard that allows me to see Incidents without Interactions

4 REPLIES 4

GlideFather
Tera Patron

Hi @SimonHind,

 

and can you please show us what you tried?

The interactions are stored in [interaction] table incidents in [incident] eventually [task] and if an incident is created from an Interaction, this relationship is stored in [interaction_related_record].

So you can query all the incidents that AREN'T in this table interaction_related_record, because if they are then it means they have an interaction associated. It could be possible to use GlideAggregate instead of GlideRecord as you want to get just number without any data manipulation to it.

 

And don't forget to add some period of time - all incidents created in last 30 days etc... 

 

Share us here your progress

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


@SimonHind the script below might be beautified but it works and could serve as an inspiration:

 

In my PDI I set encoded query on 5 incidents where only 1 has interaction, remaining 4 don't:
(your condition will be different - created in last 30D, 7D, has this or that category, assignment group etc.)

KamilT_0-1752878652411.png

 

KamilT_1-1752878686136.png

 

 

var incidentGR = new GlideRecord('incident');
incidentGR.addEncodedQuery('category=hardware^priority=1'); //5 incidents match this
incidentGR.query();

while (incidentGR.next()) {
    var hasInteraction = false;

    var irrGR = new GlideRecord('interaction_related_record');
    irrGR.addQuery('document_id', incidentGR.sys_id);  //just 1/5 has an interaction
    irrGR.query();

    if (irrGR.hasNext()) {
        hasInteraction = true;
    }

    if (!hasInteraction) {
        gs.print('Incident without interaction: ' + incidentGR.number); //remaining 4 Printed
    }
}

 

Let me know what do you think and if this helped you and my efforts were not for nothing :))

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


 

related.JPG

This is my basic Report using the Interaction related Record

it shows ID of related record with Incident: INC#######

166 in total, however if I switched to Incident table

 

 

Incidents.JPG

 

ideally what I am looking for is all Incidents where there are no Interactions, so i hope my Interaction related Record is correct for this

AndersBGS
Tera Patron
Tera Patron

Hi @SimonHind ,

 

You just need to add a related list condition like below:

AndersBGS_0-1752907019434.png

 

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/