3

I have a custom field type created by inheriting default SPFieldLookup type field.

I have a SharePoint custom list with these type of fields. I want to fetch list items from this list using REST API. I want to get data from list using REST API and filter it using these custom field type columns.

I have tried below URL for that but it's not working:

http://<SITE_URL>/_api/web/lists(guid'bf3bf2d7-e352-456a-98b2-a6738e44390f')/items?$select=ID,Title&$filter=Country%20eq%20%27INDIA%27

Here, Country is the column with custom field type.

It seems custom field type columns are not working with REST API.

Any help on this would be much appreciated!

1 Answer 1

-1

Lookup-fields are objects that have properties. If your Country-lookup has a returned field called Title, you must expand it and include the field in the select. Your query would look something like this:

http://<SITE_URL>/_api/web/lists(guid'bf3bf2d7-e352-456a-98b2-a6738e44390f')/items?$select=ID,Title,Country/Title&$expand=Country&$filter=Country/Title%20eq%20%27INDIA%27
2
  • 1
    It will work with OOTB lookup type column. I have created "Country" column with custom field type( for example: this type of field : boostsolutions.com/cascaded-lookup.html) And I want to filter on this type of column. Commented Dec 22, 2017 at 11:09
  • Is this on an older version of SharePoint? I'm not really sure custom fields are supported anymore, the last i can find of any documentation relates to SP 2007 / 2010. You may have more success with JSOM or CSOM to obtain the field value, i wouldn't honestly get my hopes up though. Are you sure your business requirement cannot be solved by simply using standard SharePoint fields? Most logic (such as the cascading) can easily be constructed by using a front-end code snippet using for instance jQuery.
    – Helge S
    Commented Dec 22, 2017 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.