Hi Team, I have received task please guide me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 11:01 AM
- Notify a user’s manager, when his/her employee notice period end date is between 30 to 40 days from today’s date.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 11:07 AM
How a user is raising request for leaver?
If you are using the catalog item and if there is variable which captures End Date or leaving date.
Create Flow
Trigger
Schedule
Action
LookUp records
For this put condition
Get Variable
End Date relative 40 days before end date
Action
Email Notification
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 11:11 AM
Hi, unfortunately the information in your post does not provide the community with clear details of your configuration or requirement. A solution would be a scheduled job running on the table that contains the user record and 'notice period date', the job would use glide-record to filter records so that results match the notice period date range, from this you would trigger a sysevent for each record(user) and then consume the sysevent in an email notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 12:20 PM - edited 03-03-2024 12:23 PM
Hi,
Create scheduled job with below script:
var ceTasks = new GlideRecord('sn_hr_core_task');//change table name
ceTasks.addEncodedQuery('//add your query');
ceTasks.query();
while (ceTasks.next()) {
var getEffStrDate = ceTasks.work_end_date; //get the date of your end date field
var effStrDate = new GlideDateTime(getEffStrDate);
effStrDate.addDaysLocalTime(-31);
var get60DaysDate = effStrDate.getLocalDate();
var toDateTime = new GlideDateTime();
var toDate = toDateTime.getDate();
var compareDateTime = get60DaysDate.compareTo(toDate); //Comparing both dates
if (compareDateTime == 0) {//modify if loop according to your requirement 30 to 40 days
gs.eventQueue('sn_hr_core.decison_31_days_global', ceTasks, ceTasks.assigned_to);//create event and notification
}
}
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda