What the doc says is correct. It is useful when you need to query the related records for some features, but no need to get those feature details. Here is the code snippet from ESRI document. Consider to replace [graphicAttributes.OBJECTID] in relatedQuery.objectIds = [graphicAttributes.OBJECTID]; with the objectIds returned from the queryIds method call.require([
"esri/layers/FeatureLayer", "esri/tasks/RelationshipQuery", "dojo/_base/connect", ...
], function(FeatureLayer, RelationshipQuery, connect, ... ) {
var featureLayer = new FeatureLayer( ... );
var relatedQuery = new RelationshipQuery();
relatedQuery.outFields = ["AGREE_WITH_INCIDENT"];
relatedQuery.relationshipId = 1;
//query for the features related to the "clicked" feature
connect.connect(featureLayer, "onClick", function(evt) {
graphicAttributes = evt.graphic.attributes;
relatedQuery.objectIds = [graphicAttributes.OBJECTID];
featureLayer.queryRelatedFeatures(relatedQuery,relatedRecords);
}
...
});