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

  • You can directly form the URL like /<site collection>/Lists/ListName/DispForm.aspx?ID=<LookupItemID> – users1100 Aug 29 '18 at 11:32
  • How to get the LookupItemID – Priyanka Aug 29 '18 at 11:40
  • How you are showing the lookup items in your report. can you share your script – Sunil Sahu Aug 29 '18 at 11:57
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}
  • It is returning ID=UNDEFINED – Priyanka Aug 29 '18 at 15:49
  • Can you please post your code, which is being used to fetch the list items? – Prakash Aug 30 '18 at 6:46

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.