Notification

Mark Wood
Tera Contributor

Hello Experts,

I want to send notifications 30,60 and 90 before the end date. can anyone please how can I achieve this?

Thank You.

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Mark Wood 

you can use flow designer for this

https://www.youtube.com/watch?v=hVctTUMWIcs

https://www.youtube.com/watch?v=zsY0JyVBPz4

OR

you can use daily scheduled job for this; sample script below; enhance for your case

sendEmail();

function sendEmail(){
	try{
		var hrProfile = new GlideRecord('sn_hr_core_profile');
		hrProfile.query();
		while(hrProfile.next()){

			var gdt = new GlideDateTime(hrProfile.employment_start_date);
			var nowTime = new GlideDateTime();

			var duration = GlideDateTime.subtract(gdt, nowTime);
			var days = duration.getDayPart();
			if(days == 30){
				// event
			}
			else if(days == 60){
				// event
			}
			else if(days == 90){
				// event
			}
		}
	}
	catch(ex){
		gs.info('Exception'+ex);
	}
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi @Mark Wood 
Flow designer is the right thing to use in this scenario.

 

 


Thanks and Regards,

Saurabh Gupta

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Mark Wood 

This is easily achievable via flow designer or scheduled jobs, but recommended is flow

 

https://www.servicenow.com/community/developer-forum/how-can-flow-designer-email-the-schedule-for-th...

 

https://www.servicenow.com/community/sysadmin-forum/flow-designer-how-send-email-after-x-amount-of-t...

 

https://www.servicenow.com/community/now-platform-forum/how-to-send-a-notification-in-the-flow-desig...

*************************************************************************************************************
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]

****************************************************************************************************************