Lookup a child item ID in the parent item
- This topic has 1 reply, 2 voices, and was last updated 10 years, 2 months ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Home › Forums › General discussion › Lookup a child item ID in the parent item
Hi,
I would like to display a child edit form in the parent form using iFrames. In order to do that, I need to be able to identify the child ID in the parent form when the “Title” fields from both lists are the same. The “Title” field is unique in each list so this will be a 1 to 1 relationship. The Child ID will be passed to the iFrame URL in the parent form. Do you have any suggestions for the best way to query the child list for the ID when parent Title = child Title?
Thanks!
You can use a query like this:
var res = spjs.utility.queryItems({"listName":"The display name or the GUID of the child list","query":"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>"+getFieldValue("Title")+"</Value></Eq></Where>","viewFields":["ID","Title"]});
alert(res.items[0].ID);
Hope this helps,
Alexander