- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2017 01:16 PM
I am needing to retrieve the date/time that the last clone was performed on the current (target) instance via server-side script. Is there some hidden System Property I can fetch with gs.getProperty() or by using some other means? The date/time only needs to be approximate (+/- 12 hours). Querying the Clone History table would be very easy on my Production instance except that I need to do this on a non-Production instance.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 01:29 PM
Thanks Matthew! Sorry for the delayed response. Great info.
I am now considering using the System Upgrades record shown below for determining the clone date/time.
This record is generated from the out-of-the-box Clone Cleanup Script shown below. I am hoping that this cleanup script will be around for the long hall so I can rely on the System Upgrade record it generates above. Do you have any concerns on the reliability of using this record?
I am actually using the Upgrade finished date/time value to retrieve a list of Customer Updates created since the last clone was performed. Here is the URL: sys_update_xml_list.do?sysparm_query=application=javascript:gs.getCurrentApplicationId()^sys_updated...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2017 02:05 PM
I have even considered querying the stats.do page to retrieve the Started date shown below, but that's pretty convoluted, and I'm not sure that that date is guaranteed to be close to the actual clone date.
Servlet Statistics
Started: Mon Apr 17 22:13:58 PDT 2017
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2017 02:44 PM
You can get the servlet started value through the sys_status table. But you are right, it is not reliable because nodes may be restarted for many reasons.
var status = new GlideRecord("sys_status");
status.get("name", "system.startup");
var lastStartedDate = status.getValue("value");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 01:29 PM
Thanks Matthew! Sorry for the delayed response. Great info.
I am now considering using the System Upgrades record shown below for determining the clone date/time.
This record is generated from the out-of-the-box Clone Cleanup Script shown below. I am hoping that this cleanup script will be around for the long hall so I can rely on the System Upgrade record it generates above. Do you have any concerns on the reliability of using this record?
I am actually using the Upgrade finished date/time value to retrieve a list of Customer Updates created since the last clone was performed. Here is the URL: sys_update_xml_list.do?sysparm_query=application=javascript:gs.getCurrentApplicationId()^sys_updated...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 01:37 PM
Hi Jim,
I don't have any concerns about the reliability of that record. It gets run after every clone and will be specific to the target instance. Looks like you found a good solution.
Matthew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2017 07:57 AM
Just a clarification that the URL I included above actually returns a list of Customer Updates created since the last clone was performed, and applies additional filter criteria that only returns updates that are within the scope shown in the current user's Application Picker.