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.
Thanks.