How does is(dynamic) me filter work?

ArpitaVK
Tera Expert

Hello

I have applied a filter on incident records. One of the filter is Assigned to Manager is(dynamic) me. I have a scheduled job which fires an event to trigger a notification. The scheduled job also contains this condition in the encoded query. When I am logged in and test it for me, the notification is triggering. But if I impersonate a user and test it, the Notification is not triggering. So I wonder is(dynamic) me filter considers the logged in user or the impersonated user as well? As, when I impersonate a user, and reapply the filter on incident records, it works fine. But Notification does not trigger.

Can anyone please explain?

3 REPLIES 3

Sagar Pagar
Tera Patron

Hi @ArpitaVK,

 

To execute scheduled jobs, we require admin or schedule_admin access. I believe you have this access, which is why notifications are working for you. However, when impersonating other users without the admin or schedule_admin role, notifications may not work as expected.

 

I suggest removing the "Assigned to Manager is (dynamic) me" filter condition from the scheduled job and updating the scheduled job to run as the System administrator. It will triggers the notifications.

 

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Hello @Sagar Pagar 

I have verified that the users I am impersonating have admin role. Still notifications are not triggering.

Maddysunil
Kilo Sage

@ArpitaVK 

when you use a dynamic filter condition like "Assigned to Manager is (dynamic) me", it typically refers to the user who is currently logged in, not the user who is being impersonated. This means that the filter will apply based on the user session of the currently logged-in user, not the user being impersonated.

When you impersonate a user and reapply the filter on incident records, it works fine because the filter condition is being applied based on the context of the user session of the impersonated user.

 

However, when it comes to the scheduled job firing an event to trigger a notification, it operates independently of the user session. Scheduled jobs are typically executed in the background by the system and do not necessarily have access to the current user session or impersonation context.

In your case, if the notification is not triggering when you impersonate a user, it's likely because the scheduled job does not have access to the impersonated user's context. Therefore, it's not applying the dynamic filter condition correctly.

As @Sagar Pagar  suggested you can remove the "Assigned to Manager is (dynamic) me" filter condition from the scheduled job and updating the scheduled job to run as the System administrator.

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks