- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 07-01-2022 04:31 AM
Scenario : Compare a given date with the current date in order to send a reminder notification after N number of days have been passed based on the updated timestamp of a record
Traditional approach
The logic that generally comes to our mind is comparing the time stamps using the function dateDiff.
The earlier approach was to create scheduled job with a script to compare dates and perform the operation.
Disadvantages : dateDiff() is not available to be used within scoped applications. In addition, it also requires scripting where we need to play with two date fields. Trust me it's not fun. 😛
Low code approach
We can leverage the flow engine of ServiceNow. By now, you might be thinking that I am going to talk about building a custom action and playing within that. Be assured , this is not the case.
We will be using transform functions available within a flow. Along side ,we will be using a schedule date trigger to run a flow daily . Here you go :
Step 1 : If you look at the below screenshot , you could see that I have used "Add time" function and added the duration . E.g. I wanted to fire a notification after 164 days from now or I could say on the 165th day.
Step 2 : We need to convert the date to string(for better comparison) using a second transform function called "Date to String" and set an output format
Step 3 : Compare the date(i.e . string version of updated time+164 days)with the trigger date(will be the current date as the flow runs daily). Before making the comparison, please make sure that you are also deriving the string version of the trigger/current date. Once done, use an if logic to compare the dates and you are all sorted.
Happy learning !
Cheers,
Subham Kumar Shaw
Senior ServiceNow Consultant
- 2,164 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Had no idea about the Add Time transform, and low key I'd thought of building a custom action for it.
Thanks for the time save.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Absolutely

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Nice and Short. Great Content!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks mate