Lookup a child item ID in the parent item

Home Forums General discussion Lookup a child item ID in the parent item

Viewing 1 reply thread
  • Author
    Posts
    • #12931
      Penny Kingston
      Participant

        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!

      • #12962
        Alexander Bautz
        Keymaster

          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

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.