0

How to fetch I'd of the parent list from a lookup column value. I have created a report using jQuery data table in child list.( Ihave the lookup column in this list which is referring to the parent list) .I want to make the lookup column clickable in the report and redirect to parent list disp form

3
  • You can directly form the URL like /<site collection>/Lists/ListName/DispForm.aspx?ID=<LookupItemID>
    – users1100
    Aug 29, 2018 at 11:32
  • How to get the LookupItemID
    – Pp25
    Aug 29, 2018 at 11:40
  • How you are showing the lookup items in your report. can you share your script
    – Sunil Sahu
    Aug 29, 2018 at 11:57

1 Answer 1

0

If you used the Rest API then the query should be as below

/_api/web/lists/getbytitle('List Title')/items?$select=LookUpField/Title, LookUpField /Id&$expand= LookUpField

Here you have to expand the LookUpField to get the id as shown above. Then you can get the ID in your success method as below.

Function Success(items){
 if(items.length > 0)
    var lookupValue = (items[0]. LookUpField.Title;   
    var lookupID = items[0]. LookUpField.Id;   

}

Use this id to open your parent list item

{site collection}/Lists/ListName/DispForm.aspx?ID={lookupID}
2
  • It is returning ID=UNDEFINED
    – Pp25
    Aug 29, 2018 at 15:49
  • Can you please post your code, which is being used to fetch the list items?
    – Prakash
    Aug 30, 2018 at 6:46

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.