RajC59005800307
Tera Guru

To get this done i created one custom field (checkbox) on RITM table (hide it on front end) 

(function executeRule(current, previous /*null when async*/) {

    //  work notes are updated
    if (!current.work_notes.nil()) {
    
        var creationTime = new GlideDateTime(current.sys_created_on);
        var currentTime = new GlideDateTime();

        // calculate the difference in seconds
        var diffSeconds = (currentTime.getNumericValue() - creationTime.getNumericValue()) / 1000;

        // Convert seconds to hours
        var diffHours = Math.round(diffSeconds / 3600);

      

        //  difference is within 2 hours and if the item is "Market Research"
        if (diffSeconds <= 7200 && current.cat_item == '5a1efa5947520510f53d37d2846d439b') {
            current.u_earlyresponce = true; // Set early response to true
        } else {
            current.u_earlyresponce = false; // Set early response to false
        }
    }

})(current, previous);

From this i was able to get the RITM on which work notes are added within 2 hours 

Kindly mark it correct and helpful if it is applicable.

Thanks,

Raj

View solution in original post