Events not triggering within a business rule

matthew_hughes
Kilo Sage

I've created the below business rule where I'm trying to generate two events. I'm wanting it to trigger when records within the 'x_lbg_group_recert_grp_recertification' get created on the current date:

matthew_hughes_1-1745911261844.png

matthew_hughes_2-1745911299199.png

 

My two events are:

matthew_hughes_5-1745911546208.png

 

The records are being created via a Scheduled Job. However what I'm finding that even though there are records that are being created today, it's not generating the two events:

matthew_hughes_3-1745911380936.png

matthew_hughes_4-1745911460642.png

 

So I was just wondering if anyone knows what I'm doing wrong so that I can generate the two events

 

 

 

 

 

17 REPLIES 17

Hello @matthew_hughes ,

 

The above script you are using already has a set of i.e. "globalNotifiedManagers", we can use the same to get the unique Manager's email with few below tweaks:

 

if (typeof globalNotifiedManagers === 'undefined') {
    globalNotifiedManagers = new Set();
}

var recertTasks = fd_data.trigger.current;
var manager = recertTasks.group_manager;

//Changing below condition to check if email address is already in the set and "manager" = true and has email address
if (manager && manager.email && !globalNotifiedManagers.has(manager.email)) { 
    globalNotifiedManagers.add(manager);
    return manager.email;
}

 


If this solution helped resolve your issue, please consider marking it as helpful or correct.
This will assist others in finding the solution faster and close the thread.

@matthew_hughes 

Any reason not to use the notifications directly?

This will avoid event, flow etc

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar  The reason why is because each record has a 'Group Manager' and I want to avoid duplicate emails being to the same person more than once.

@matthew_hughes 

So basically you want 1 email per day to Group manager clubbing the records which got created today?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar  The email needs to be sent to the Group Manager on the first day of each quarter.