Send notification if account expiry in 30 days

Bidduam
Tera Guru

On our user profile we added some time ago a field called "u_account_expiry".

What I need to do is send an email notification to the user and their manager if the users account expiry will occur within the next 30 days.

 

How would I go about getting the 'list of users' that fit into that category to add as the recipient in a notification?

 

I figured I could do it in a flow or a scheduled job, but either way I don't know how to generate the list of users and their managers.

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

You could create a daily Scheduled Flow, query through all the users where u_account_expiry is 30 days from now, and create a notification to that user and their manager.

 

Give it a try.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

5 REPLIES 5

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

You could create a daily Scheduled Flow, query through all the users where u_account_expiry is 30 days from now, and create a notification to that user and their manager.

 

Give it a try.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

@Mark Roethof I have been able to sort of using a "look up record" on the user table, however it is getting the first user and stopping there.

If I try to use a "Look up records" I can't use a record in the fire event to trigger the notification

How would I get it to loop and get all users? Ideas?

@Mark Roethof I'm going to mark your reply as the solution as it ultimately pointed me in the right direction, thank you.

 

This is what worked for me - no code needed at all 😀

Bidduam_0-1722906007214.png

 

 

mihirlimje867
Tera Guru

Hello @Bidduam ,

Step1: Create the event from event registry.
Step2: Create the Notification in that set the trigger condition to event and select the created event in step1.

Step3: Create a scheduled job and run as daily. In that you can add the script for checking how many user that account expire in 30 days. and in the while loop you can call the event and pass the user's email as a receipent.

It will help in your senario for every user's.
Please like the answer if you think this helps you.
Thank you.