- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2019 01:43 PM
Hi Developers,
In the documentation says "True if the current record is valid or false if past the end of the record set." but I don't really understand what would make a record invalid.
Could someone please explain me what "false if past the end of the record set" really means?
Thanks, Cesar.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2019 02:12 PM
Hi Cesar,
An example of this would be in UI actions, for example if I want a script to run only if the record hasn't been submitted yet, or when you are doing a Glide Record query by supplying a sys_id, however there is no record with that sys_id in the table you are trying to query, gr.isValidRecord() in this case would return false. Hope that makes sense.
Regards,
Phuong
If you find my suggestions helpful, please mark it as correct or helpful to help out others as well 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2019 02:12 PM
Hi Cesar,
An example of this would be in UI actions, for example if I want a script to run only if the record hasn't been submitted yet, or when you are doing a Glide Record query by supplying a sys_id, however there is no record with that sys_id in the table you are trying to query, gr.isValidRecord() in this case would return false. Hope that makes sense.
Regards,
Phuong
If you find my suggestions helpful, please mark it as correct or helpful to help out others as well 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2019 02:13 PM
Run this in scripts - background to see what they mean by this. What it means is that if you did gs.info(rec.isValidRecord()) in the while loop it will be true, but outside of that loop its false.
var rec = new GlideRecord('incident');
rec.query();
while (rec.next()) {
gs.info(rec.number + ' exists');
}
gs.info(rec.isValidRecord());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2019 09:07 AM
Thank you for your responses, now I understand what "false if past the end of the record set" really means, but for example I have a business rule (before update) with a condition current.isValidRecord() and most of the times it will execute without a problem but sometimes it will not get executed even when the record gets updated with the new data.
Could someone please explain me what is going on?
Thanks & Regards, Cesar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2019 09:12 AM
Hello Cesar,
current.isValidRecord() returns true if table is valid or if record was successfully fetched, or false if table is invalid or record was not successfully fetched.
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade