I'm having an issue with the QueryRelatedRecords function on ArcGIS Server 10.3.1.
When one of the feature classes or tables involved in a relatationship is joined to another table, QueryRelatedRecords only returns results when querying from the joined side of the relation. Querying from the other side of the relation back to the joined table/feautre class returns no results.
If the join is removed QueryRelatedRecords works fine in both directions, with no changes to the relationship.
I have tested with feature classes, tables, and query layers. It doesn't seem to matter what combination of relations are configured, if there is a join of any kind involved then QueryRelatedRecords only works in one direction (e.g. Joined layer > Table, not Table > Joined Layer).
There are no errors in the ArcGIS Server log, the response returned still includes the field info from the related layer, it just contains no related record groups. My guess would be it's something to do with joined layers using fully qualified field names?
I have attached a test database and MXD I used to create a map service. If published with the join in place then using QueryRelatedRecords on the layer will return results from the related table, but if you use QueryRelatedRecords on the related table you get no results returned. If you remove the join and republish the service then QueryRelatedRecords works on both the layer and related table.
Has this issue been resolved in newer versions of ArcGIS Server?