Go To Related From Found Set when only a subset has related records returns an error code
Operating system version
Description of the issue
Go To Related from Found Set returns an error code if there are child records for only a subset of the found set, but not the current record.
This is problematic when testing if there are child records. If the current record has no related, or the found set doesn't, you will still get the same error. If there are related, you will go to the layout specified, otherwise you stay put. This means you can't rely on Get Last Error or Get Found Count since either can return a false error.
Steps to reproduce the problem
Create a found set that has related records for only a subset. Go to a record that does not have child records, and preform a Go To Related Records from found set. Test for error code.
If any of the found set has related records, an error or 0, otherwise an error code.
Receive an error code if the current record has no related, even if the found set contains a subset that does have related.
Exact text of any error message(s) that appear
There are a few, but it would be nice to have a reliable error code:
1. Loop through the parent records until you find one with child records (really this seems silly to have to do).
2. Test for layout name (never recommend hard coding layout names in scripts, that's just asking for trouble).
3. Do a Set Field in the target table, and then Get Last Error. If I do have some related from my found set, I'll get an error of 0, otherwise I didn't move off the parent table, can't set the field, and get an error code (The most reliable and clean solution).