- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 11:39 PM
Hello all,
I'm new in servicenow and still learning scripting on it and would appreciate your help on this.
Requirement:
- Look for all user accounts that will expire 14 days from the current date then send a reminder to the manager.
From user's table: we have a field called AD Account expires (date/time field)
I am trying to achieve this via flow designer but unable to capture the condition from look up records to show exactly the account lists that about to expire in 14 days. The closest I was able to achieve was using the relative operation which is not exactly what I need since it shows all accounts that will expire in 14 days less.
May I ask your expertise if you have encounter this before? Thank you in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 06:08 AM
Thank you everyone for the assistance. I was able to figure it out via creating action script in flow designer.
For reference, here's the script I created:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 01:55 AM - edited 08-15-2024 01:57 AM
Hi @manueleriklego ,
You can achieve through schedule job as well.
gs.eventQueue('event name',userGr,managerEmail, ' '); //this API is used to send for a email notification.
Generating Events | ServiceNow Developers.
How to Create a Notification and Trigger Email in ServiceNow (youtube.com)
Please mark helpful & correct answer if it's worthy for you.
https://www.youtube.com/watch?embeds_referring_euri=https%3A%2F%2Fwww.bing.com%2F&embeds_referring_o...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 03:59 AM
You'll need to test this to confirm, but I think you just need to change it to use 2 conditions:
1. AD account expires before 15 days ahead
2. AD account expires after 13 days ahead
In theory this should give you everything that expires in exactly 14 days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 05:11 AM
In the Flow Designer
1. Define a variable and set a date 14 days from today
var fourteenDaysBefore = gs.dateAdd(gs.now(), 14);
return fourteenDaysBefore
2. Use the variable as a condition to extract the target user records
3. Send a notification for each extracted user record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 06:08 AM
Thank you everyone for the assistance. I was able to figure it out via creating action script in flow designer.
For reference, here's the script I created: