- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2022 12:44 PM
I wanna check if "last discovered" date is greater than 30 days of the current date. please help me to rectify below script. will client script applied on database instance class is applicable to all its child classes? i wanna make it applicable to all its child classes.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2022 12:19 PM
Well, you can use the business rule as follows;
When to run
Actions
Advanced
I believe that you are looking for a way to schedule a GlideRecord on this table and set the status of those records which have not been discovered for more than 30 days.
In case, if this is your requirement then you need to implement a scheduled job as follows;
Also make sure to adjust Run and Time fields as per your requirements.
Hopefully this will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2022 09:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 01:15 AM
That is correct. Install Status is an integer type field so you need to update your BR script as below:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var last_discovered = new GlideDateTime(current.last_discovered);
var getCurrentDate = new GlideDateTime();
var time_diff = gs.dateDiff(last_discovered, getCurrentDate, true);
if (time_diff >= 2592000) {
gs.addErrorMessage('30 days have crossed');
current.install_status = 100; // 100 is the value for Absent
}
})(current, previous);
This should work for you.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 02:04 AM
Guys, I tried a lot but unable to set the value of field Status on database instance table
please check line 7,8 and 9 , tried with all combinations but status is not updated. can you please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 03:46 AM
Just want to check if you have marked the appropriate response as correct here, as I have clearly first suggested you to use a Business Rule approach and shared the script with you which you need to use here along with proper screenshots
However I was not aware that you need to set your Install status field which was not mentioned in your question before and then have updated it correctly.
I do not have any concern for other answer to be marked as correct but just thought of checking as I first called out and routed you in the correct direction of using a Business Rule
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 11:00 PM
yes it is my mistake that i didnt mention that i need to update field.
I am also concern of existing records and observed schedule job is better option.
I appreciate all your help always and yes your answer is also tending towards correct direction but i used scheduled job