Quantcast
Channel: Microsoft Dynamics CRM
Viewing all articles
Browse latest Browse all 154803

Forum Post: Getting all related Contact for an Account entity in Dynamics 365 CRM v9.0 web api

$
0
0
I've read a few questions regarding this and the proposed solutions don't fit with what I am seeing in the CRM web API. At any rate... Basically, I'm querying the D365 web API and I'm trying to get all of the related contacts for an account. Been following this link: docs.microsoft.com/.../query-data-web-api Trying to use $expand but it only will bring over _primarycontactid_value . So just the one primary contact and not everyone that is related to the Account. It would look something like the following: /api/data/v9.0/accounts&?select=name&$expand=Contacts(fullname, email) The only fields in Account that have "contact" in them are: preferredcontactmethodcode _primarycontactid_value address2_primarycontactname address1_primarycontactname _tcc_primaryinvoicecontactid_value _tcc_consultingcontact_value _tcc_contactlist_value //some custom field that doesn't apparently do anything _new_foundationcontact_value _tcc_primaryapcontactid_value So none of which can be used to look-up all of the contacts... that I know of. Another way to do it would be to start with the Contact first and then $expand= on the _parentcustomerid_value . But I need to filter on the Account to specify certain accounts that I want... this would just bring over every account and be incredibly slow. I'm not sure there is a way to $filter= on an $expand= value. So: 1. How can I query the Account and all the related to Contacts for an Account? 2. If there is no way, is it possible to use $filter= on and $expand= value? Trying to keep the amount of queries to a minimum. This could be solved by doing multiple iterative queries, but that will just make it incredibly slow. Or just query everything and piece it together, but that will be slow as well.

Viewing all articles
Browse latest Browse all 154803

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>