Notification not getting triggered.

swathi55
Tera Contributor

Hello,

 

I need to trigger an email when a user with admin access login to prod.  I wrote a After BR on Insert and update on User Role[sys_user_has_role] table-> created a event and a notification. But the BR is not executing and event is not triggering.

 

Is there any other approach or better way to do it?

 

Thanks

 

1 REPLY 1

Tejas Adhalrao
Mega Sage

hi @swathi55 ,

The sys_user_has_role table is updated when roles are assigned or removed, not when a user logs in. That's why your Business Rule isn't triggered during login.

I would suggest using a login-triggered mechanism, such as a Login Event or a Business Rule on the appropriate login-related event, to check whether the logged-in user has the admin role. If they do, queue an event and trigger the email notification.

Make sure you test this carefully in a non-production instance first to avoid generating unnecessary emails.

 

If this helped, mark it helpful and accept the solution.

Regards, Tejas