I'm trying to get the information of the customer of a campaign response in Dynamics CRM 2016 (on-premise). Because I'm on an entity form I want to use JavaScript for the REST queries.
Retrieving the information of the campaign response is not the problem. In the response XML though, the PartyId is of type EntityReference
... <!-- more XML omitted -->
<d:PartyId m:type="Microsoft.Crm.Sdk.Data.Services.EntityReference">
<d:Id m:type="Edm.Guid">13cb3e39-46c5-e711-80ce-005056a04f81</d:Id>
<d:LogicalName>contact</d:LogicalName>
<d:Name>Jane Doe</d:Name>
<d:RowVersion m:null="true" />
</d:PartyId>
...<!-- more XML omitted -->
So now the problem is, I can't directly query dynamics for a contact using
https://example.com/OrganizationName/XRMServices/2011/OrganizationData.svc/contactSet(guid'13cb3e39-46c5-e711-80ce-005056a04f81')
I get the following error
<error>
<code/>
<message xml:lang="de-DE">Resource not found for the segment 'contactSet'.</message>
</error>
because it's an EntityReference.
There does not seem to be an Endpoint like
https://example.com/OrganizationName/XRMServices/2011/OrganizationData.svc/EntityReferenceSet(guid'13cb3e39-46c5-e711-80ce-005056a04f81')
I can't figure out how to retrieve the target of an entity reference using REST and Javascript. Is anybody out there who knows how to do it?
What I know from the C# framework is, that an EntityReference is only a Container that holds the real information about an referenced entity. So the ID that is given by
<d:PartyId m:type="Microsoft.Crm.Sdk.Data.Services.EntityReference">
<d:Id m:type="Edm.Guid">13cb3e39-46c5-e711-80ce-
is only the ID of the EntityReference and has to be resolved to the real ID of the contacts entity. But how?