- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-17-2025 03:37 AM
calculate the time duration between when was record created and when the email was trigger
?
ex: duration = email created time - record created time
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-17-2025 03:51 AM
whenever you are triggering that email you know the now time, you also know on which record email triggered
So pick the sys_created_on time
Get the difference using script something like this in your email script if you wish to send this difference in email body
var nowTime = new GlideDateTime();
var createdTime = new GlideDateTime(current.getValue('sys_created_on'));
var dur = new GlideDuration();
dur = GlideDateTime.subtract(createdTime, nowTime); //the difference between
template.print(dur.getDisplayValue());
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-17-2025 03:51 AM
whenever you are triggering that email you know the now time, you also know on which record email triggered
So pick the sys_created_on time
Get the difference using script something like this in your email script if you wish to send this difference in email body
var nowTime = new GlideDateTime();
var createdTime = new GlideDateTime(current.getValue('sys_created_on'));
var dur = new GlideDuration();
dur = GlideDateTime.subtract(createdTime, nowTime); //the difference between
template.print(dur.getDisplayValue());
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2025 07:02 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2025 02:28 AM
why you are used nowtime ?
is there any way with database view ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2025 02:38 AM - edited ā01-21-2025 02:44 AM
The reason I used now time is because the current time is the time when email was triggered, so you can use that as a reference
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader