You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This piece of code can be used to check whether a record was created more than 90 days ago or not.
3
+
It returns an output of true/false as well as the actual age (in days) of the record.
4
+
5
+
**Type**:
6
+
Background Script
7
+
8
+
**How it works**:
9
+
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.
10
+
In the actual code I have hard-coded a value to be used as an example.
11
+
-There are two gliderecord objects to store the current date as well as past date
12
+
-GlideDateTime.subtract() is used to calculate the time difference as a GlideDuration object
13
+
-The time duration in milliseconds is converted to days by dividing with 86400000(milliseconds in a day)
14
+
-Comparison is done between the results
15
+
-The final age of the record and true/false result of the comparison is the output.
0 commit comments