Consider two lists: ListA and ListB with ListB having a lookup to ListA. So multiple items of ListB could be related to items of ListA.

Using custom JavaScript (via an App) on the ListA item forms, I am showing the related items of ListB (by fetching all ListB items where lookup field value is equal to Id of the ListA item).

There is also a 'New Item' link on ListA forms (new and edit) to launch the new form for ListB items. Is there a way for items created via this link to be linked to new item of ListA when it is saved? For edit form I plan to pass the ListA item Id as query string parameter and have a script on new item form of ListB to set this value in lookup field. Don't know how to do this for New form of ListA.

Note: I have done something similar in on-premises using custom fields. It was like a combination of hidden fields having a common guid and save item event receiver that searched for items with that guid and then set the lookup field value. For online would like to avoid any sandbox solution or remote event receivers.


  • Don't know how to do this for New form of ListA. Isn't listA supposed to be ListB in this part of your question. If not, I don't understand the question correctly. If so, what is the problem with using query string params and javascript to set the lookupfield on a new form?
    – Oak3
    Dec 10, 2015 at 9:45
  • It is ListA form only. User brings up new form of ListA and wants to create ListB items by clicking on 'New Item' link on ListA form. User will save ListB items and then ListA item as well and expect that those ListB items should be linked to ListA new item automatically. Ex. In New Purchase Order form (ListA), user wants to add several line items that come from other list (ListB)
    – Prakash
    Dec 10, 2015 at 11:35
  • Ok this makes it a bit clearer for me. The difficulty is that on saving list A & B together, you won't have an ID of the newly created list item a.
    – Oak3
    Dec 10, 2015 at 12:04

1 Answer 1


my solution is to start WF on create list item. In WF I run powershell script (I use extended WF activities from ILoveSharePoint package), that search for author and empty IDListAItem on all items and then set the IDListAItem. If two users make new item at the same time, both see only their own items from ListB in New Form for item in ListA. If you cancel new item with some items from ListB already created, next time you open new form, you see them again. So it is useful to allow user to delete items from listB in new form for listA.

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.