Reputation: 4292
I am building a dynamic form where user can select any entity and its fields. and if field is lookup, user can select field from look so far it is working fine except for contact/account.
When I get contact entity metadata of contact it has account lookup but when i try to retrieve using all account column attribute does not returned.
Below is the code and attribute result i am getting.
Thanks
Upvotes: 0
Views: 728
Reputation: 86
Microsoft has implemented functionality that Retrieve Multiple does not return attributes which has value null. That's why you are not getting all attributes.
References: https://community.dynamics.com/crm/f/117/t/289412
Upvotes: 2
Reputation: 1718
The confusing thing here is that accountid and parentcontactid are not actually fields on the contact table. They are "virtual" fields provided by the CRM application for simplifying things like workflow operations where you need to target a specific type of parent customer record.
You need to instead use the parentcustomerid field which is the lookup to the parent account or parent contact. The parentcustomeridtype field tells you which type is referenced (account = 1, contact = 2). Fortunately this is generically handled by the EntityReference object and you can probably treat it about the same as any other lookup in your code.
Upvotes: 1