I am trying to query Salesforce opportunities from another Salesforce org using the Query API
I am setting the following query in the endpoint method
request.setEndpoint('callout:'+namedCredential+'/services/data/v56.0/query?q=select+Id,+Name,+Amount+from+Opportunity+where+Brand__c+in+('+brandIdString+')');
Now, the above query works fine and returns all the required Opportunities.
However, now what happens is that if I try to add any relational field in the query, it fails. e.g. the below request fails
request.setEndpoint('callout:'+namedCredential+'/services/data/v56.0/query?q=select+Id,+Name,+Amount,+Brand__r.Address__c+from+Opportunity+where+Brand__c+in+('+brandIdString+')');
Is the above not possible? If not are there any alternatives for the same?
system.debug(results)
to display the resulting values? if so, system.debug will not display parent field values of sobjects. The values are there, but must be explicitly enumerated in a debug statement