How to create a report that can track any RITM created and not updated within business hours

AysenurU
Tera Contributor

Hello everyone 😇

 

I need to create a report that can track any RITM's that are assigned to service desk resolver group(s) (Service Desk, IT Service Desk, X Service Desk etc) and have been created and not updated within 8 business hours.

 

I could not figure out exactly how to create this report. I hope a Report wizard💫 can guide me while creating this report. I do really appreciate your time and help.

 

Thank you 

 

By the way I have tried this but not sure whether it was the right solution as it did not work out:

1- I created a true/false custom field. (u_not_updated_within_8_business_hours)

AysenurU_0-1718400594349.png

 

2- I created a business rule that tags RITMs Not Updated Within 8 Business hours (for the testing purposes  it made it 2 minutes)

AysenurU_2-1718400700630.png

AysenurU_3-1718400737796.png

***I tried to create the code with the help of ChatGPT so not sure if it is correct.***

 

(function executeRule(current, previous /*null when async*/) {
    // Only proceed if the RITM is assigned to the Service Desk group
    if (!current.assignment_group || current.assignment_group.name != 'IT Service Desk') {
        return;
    }

    var twoMinutesAgo = new GlideDateTime();
    twoMinutesAgo.addSeconds(-2 * 60); // Subtract 2 minutes

    var createdTime = new GlideDateTime(current.sys_created_on);
    var updatedTime = new GlideDateTime(current.sys_updated_on);

    // Check if the RITM has not been updated within 2 minutes of creation
    if (updatedTime.getNumericValue() <= createdTime.getNumericValue() + GlideDateTime.convertSecsToGlideDuration(2 * 60)) {
        current.u_not_updated_within_2_minutes = true;
    } else {
        current.u_not_updated_within_2_minutes = false;
    }
})(current, previous);
 
3- Then I tried to create the report. (But I don't think it is correct)
AysenurU_4-1718400943705.png

 

1 REPLY 1

Slava Savitsky
Giga Sage

The approach with a custom field to track if there was an update withing 8 hours from creation is correct, but you need to make some changes to your business rule. You don't need to run it on insert, only on update. In the code, you should never set your field to false. You should only set it to true if the "current time" at the time the business rule runs is within 8 hours of the creation timestamp of the RITM record. Also there is no need to run the business rule if the flag is already set to true.