0

I have one list with lookup column #lookupColOne and this value is used in #list2.

#List2 have a lookup column of #List1 ID field. I want to get #list2 data along with #list1 lookup column values.

Anyone suggest the idea to achieve this?

1

You can use your RESTful URL something like below:

/_api/web/lists/GetByTitle('<Display name of #List2>')/items?$select=Title,Country/ID,Country/Title&$expand=Country

Where,

  1. Country: Lookup column in #List2 which is referencing data in #List1.
  2. Country/ID and Country/Title: Gives the ID and Title for selected Item from #List1.

Note:

If you are trying to get the lookup column data from two or more levels of lookup columns then it is not supported in SharePoint REST API. Read more about it here.

0

following snippet should help you a lot. It expands data from List2 with the information from lookUp in List1

this.web.lists.getByTitle('LIST2NAME').items.select(['Column','Column/Id']).expand('Column').get().then(result => {
          return result 
});
0

You can achieve this using select and expand.

Here is the sample REST URL.

_api/web/lists/GetByTitle('ListName')/items$select=ColumnNamein#list2/ColumnNamein#list1&$expand=ColumnNamein#list2
0

You can only get the IMMEDIATE lookup values in rest api. The workaround would be to extend your 2nd lookup in list1 and get all the values you want (which will be added to list1 as text fields). You can get these values using Rest on lookup of list2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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