- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2021 02:52 AM
Hi All,
How to send email notification for every 24hrs, until 5days from the creation date.
The first notification should be fired, after 24hrs the record got created. From then, the email should be sent for every 24hrs up to 5days.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2021 12:01 AM
Hi,
gr.sys_created_by will give user name and not sys_id or email address
event parm1 requires either user sys_id or user email address
So I mentioned which field on termination task is referring to sys_user? use that field there
So that the event gets the user sys_id
OR if you are having any field on termination task which stores user email then use that there
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2021 03:22 AM
Hi,
Yes I believe that is what your requirement is
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2021 03:46 AM
Hi Ankur,
How to trigger this notification for a record after 24hrs of its creation. And also I didn't find any thing in do until logic to check created has crossed 5days.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2021 03:59 AM
Hi,
You can create Flow variable which acts like global variable.
Initialize it with 5 and for every run of do until decrement it by 1
In the Do action check if the value of global variable is greater than 0 then execute
Starting from Quebec release you have flow variable
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2021 05:23 AM
Hi
As I am using Paris version, I am unable to see flow variables option. Can we achieve this with scheduled job script? If yes could you please help me with the script.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2021 06:13 AM
yes possible via schedule job
Create schedule job which runs daily
refer below sample script
1) find the difference between created time and now time and check if the difference is less than 6
2) if yes then it would send daily email and when the difference is more than 5 it won't send email for that record
sendEmail();
function sendEmail(){
try{
var hrProfile = new GlideRecord('sn_hr_core_profile');
hrProfile.query();
while(hrProfile.next()){
var gdt = new GlideDateTime(hrProfile.sys_created_on);
var nowTime = new GlideDateTime();
var duration = GlideDateTime.subtract(gdt, nowTime);
var days = parseInt(duration.getDayPart());
// if the difference is less than 6
if(days < 6){
gs.eventQueue('event_name', hrProfile, hrProfile.user);
}
}
}
catch(ex){
gs.info('Exception'+ex);
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader