Skip to main content

Regarding my business scenario have the following two lists,

1. Business Profile 

2. Site Profile

One BusinessProfile can have more than one SIteProfile. When a user create the BusinessProfile, He able to create the SiteProfiles as well.

I have one idea. That is use a repeating section for SiteProfile in the BusinessProfile then after the form submit, Update the Repeating control data to SiteProfile List. 

But I post this question for find any other method like in my question title?

How about the below method. (tested in SharePoint 2013)

Having two lists 'List A' and 'List B'. In my 'List A' form having 'JavaScript' button called 'New Item in List B'.

On click of this button i will open 'List B' new item form and save it.

210969_pastedImage_1.png 210970_pastedImage_2.png

In 'List A' form on button click call this function

function fnCreateinItemListB()
{
var parentId = NWF$('#'+currentId).val();

//You can get current item id from ListA and store it in new item in List B(for 1 to Many mapping purpose)


var options = {
title: "My Dialog Title",
url: 'http://sites/Lists/LisB/NewForm.aspx?testId='+parentId }; //Pass Id value in url
SP.UI.ModalDialog.showModalDialog(options);
}

In List B get the id value and store it in some field.

NWF$(document).ready(function()
{
var thisId = GetUrlKeyValue('testId');
NWF$('#'+tempId).val(thisId);
});

In this way you can create multiple items in List B from Item in List A.


It is not work in SharePoint Online. Any suggestions? 


I have tested only in SP 2013. Don't have Online environment.

Is JavaScript code working to open a empty Modal Dialog from your List A page..?


No. The Modal Dialog script is not working.


Hello Lakshmi. This worked well for me. Is there a way to create a separate button that can call back all the items mapped to the Request Number so they can be edited?


Reply