Попробуйте использовать приведенный ниже код для извлечения связанных дочерних объектов для родителя:
function RetrieveRelatedChildEntities() {
var url = Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.0/EntityDefinitions(LogicalName='account')?$select=LogicalName,DisplayCollectionName&$expand=ManyToManyRelationships,ManyToOneRelationships,OneToManyRelationships";
req.open("GET", url, false);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var results = JSON.parse(this.response);
for (var i = 0; i < results.OneToManyRelationships.length; i++) {
}
}
}
}
}