Check Record creation 90 days ago or not and output record age#2134
Closed
Soumyadeep10 wants to merge 6 commits intoServiceNowDevProgram:mainfrom
Closed
Check Record creation 90 days ago or not and output record age#2134Soumyadeep10 wants to merge 6 commits intoServiceNowDevProgram:mainfrom
Soumyadeep10 wants to merge 6 commits intoServiceNowDevProgram:mainfrom
Conversation
am-shakeel
reviewed
Oct 14, 2025
Contributor
am-shakeel
left a comment
There was a problem hiding this comment.
Thank you for your contribution! I noticed that the README refers to this as a “Background Script” example, but the actual files are placed under the GlideDateTime folder. For consistency, you may want to align the folder name with the script type or update the README accordingly.
Closing this for now. Once you’ve made the necessary adjustments, feel free to re-open the PR or submit a new one. Happy to review again!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description:
Hi, before you move through the usecase I would like to let you know that 2 extra commits(Create getCIwithmostActiveInc.js and its README file) from yesterday have come into this PR. Please ignore them as they have already been accepted and merged.
Usecase:
This piece of code can be used to check whether a record was created more than 90 days ago or not.
It returns an output of true/false as well as the actual age (in days) of the record.
Type: Background Script
How it works:
There is a pastDateString variable which can contain a date-time which you received by querying any particular record's sys_created_on field or any other relevant field.
In the actual code I have hard-coded a value to be used as an example.
-There are two gliderecord objects to store the current date as well as past date
-GlideDateTime.subtract() is used to calculate the time difference as a GlideDuration object
-The time duration in milliseconds is converted to days by dividing with 86400000(milliseconds in a day)
-Comparison is done between the results
-The final age of the record and true/false result of the comparison is the output.
[Note: Output may vary according to timezones]
Pull Request Checklist
Overview
Code Quality
Repository Structure Compliance
Core ServiceNow APIs/Server-Side Components/Client-Side Components/Modern Development/Integration/Specialized Areas/Documentation
Restrictions