2

I have a list(ListA) which has a lookup field(LookupF) for another list(ListB). ListB includes a choice field(ChoiceF) which can take a single value.

I want to call the selected value of the ChoiceF by using the LookupF in SP 2013 REST API.

This url doesn't work:

http://appWebUrl/_api/web/lists/getByTitle("ListA")/items?$select=LookupF/ChoiceF&$expand=LookupF

Error: The query to field 'LookupF/ChoiceF' is not valid.

On the other if I create a calculated field(CalculatedF) which is equal to the value of ChoiceF ([=ChoiceF]) in ListB, then I can access the value using the following url:

http://appWebUrl/_api/web/lists/getByTitle("ListA")/items?$select=LookupF/CalculatedF&$expand=LookupF

I do not want to create unnecessary fields like these, just to be able to get the selected choice values. Is there any direct way to access choice values for lookup fields?

  • It is because you can only retrieve text, number or date values through lookup field. Same as when you create a lookup column and choose what additional properties you want to include. That's why your calculated column works (because it's text) and choice doesn't. I think having this calculated column would be the easiest solution for you. Or you can make two requests, first to get the lookup ids from LookupF, then second request to ListB to get the item by that id and get ChoiceF value. – Gintas K Sep 13 '16 at 13:22

Your Answer

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

Browse other questions tagged or ask your own question.