Community
Showing results for 
Search instead for 
Do you mean 
Reply

select/expand on custom fields

Copper Contributor
Posts: 175
Country: Netherlands

select/expand on custom fields

We've posted this before, but it still doesn't seem to work.

 

Why can't we do this:

 

/api/contacts?$filter=customFields/fact_betaald eq 'NEE'&$top=100&$select=id,fullName&$expand=customFields($select=fact_betaald)

 

Like we do this:

 

api/contacts?$filter=customFields/fact_betaald eq 'NEE'&$top=100&$select=id,fullName&$expand=businessAddress($select=city)

 

If we do the expand on customFields we get:

 

"Could not find a property named 'customFields' on type 'act.web.api.models.Contacts.Contact'."

Greetings,

ACT Certified Consultants
TendenZ
the Netherlands
Highlighted
Employee
Posts: 109
Country: USA

Re: select/expand on custom fields

The reason why $select or $expand doesn't work with custom fields is because customfields is just a collection of name value pairs (.NET dictionary<string, object>) and OData doesn't handle it the same as a complex type or related entity like businessAddress.  Microsoft OData $select|$expand doesn't seem to natively support this type.  Another issue that is causing this is that custom fields are not included on the OData IEDM models (design time model) because custom fields are dynamicly loaded (run time - no model).  To fix this issue the IEdm models would need to be built dyanmicly (like the API handles custom tables) with the metadata and not rely on hard-coded models.