Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

linking 2 sharepoint lists

I have Screen1 that has 2 forms on it.  each form has a sharepoint list as the datasource but there is a common ID field in each. 


In Form1 the ID is auto generated in SP once the form has been submitted along with other text fields   


In Form2 the ID field is a text field that should have as it's default the ID field in Form1 to create the relationship link between the 2

however obviously the ID field in Form1 won't be populated till after the form is submitted as it's the standard SP auto generated ID field so I'm struggling to populate the ID field in Form2 to create the relationshipSmiley Happy   


Basically Screen1  will be submitting to 2 sharepoint lists with each row linked by the ID field.   So was thinking maybe I could have the button submit form1 and then pick up the ID and populate the ID field in Form2  ready for the other fields to be completed? but don't know how to do this  also to complicate it even more it's  not just a one to one relationship I also need to possibly add more rows in Form2 with the same ID so there will basically be a one to many relationship between the 2 SP lists.  


Hope you can follow ! any advice gratefully received Smiley Happy









Super User Rank
Super User

Re: linking 2 sharepoint lists

Hi @vffdd,

You could use the OnSuccess property of the first form to create a contex variable to pass to the second form.  

Navigate(Screen2, None,{var: Form1.LastSubmit.ID})

For a one-to-one relationships, in the ID card on Screen2, change the default property of the TextInput box inside the ID field from Parent.Default to 

If(IsBlank(Parent.Default), var, Parent.Default)

In a One-to-many relationship, it's not much more complicated, you just put the above formula in the Foreign key field, not in the ID field. The IsBlank() works because an edited form will always have an ID as the Parent.Default and in a new form, the Parent.Default will always be blank.  

Community Support Team Rank
Community Support Team

Re: linking 2 sharepoint lists

Hi @vffdd,

Could you please share a bit more about your scenario?

Do you want to submit your two forms at the same time via clicking a single one button?

Based on the needs that you mentioned, I agree with @Drrickryp's thought almost. You could consider store the List Item Id of the Submitted form data in Form1 into a global variable, then set the global variable within the Default property of the Text Input control within the ID data card in Form2.

I have made a test on my side, please take a try with the following workaround:1.JPG





Set the OnSelect property of the "Submit Form1" button to following:


Set the OnSuccess property of the Edit form1 (Form1) to following:

Set(SubmittedItemID, Form1.LastSubmit.ID);

Within the Form2, unlock the Title Data card (on your side, you should unlock ID data card), set the Default property of the Text Input control to following:


The GIF screenshot as below:Test1.gif

In addition, you could also consider to submit your two forms using a single one button, and use Patch function to submit your Form2 data. I have made a test on my side, please take a try with the following workaround:


Set the OnSelect property of the "Submit Form1" button to following:


Set the OnSuccess property of the Form1 to following:

Title: Form1.LastSubmit.ID,
ProductName: DataCardValue8.Text
); ResetForm(Form1)

On your side, you should type:

IDColumn: Form1.LastSubmit.ID,
ProductName: DataCardValue8.Text,
); ResetForm(Form1)

Note: IDColumn, ProductName, etc represents the columns in your second SP list (connects to your Form2). The DataCardValue8 represents the Text Input box in your Form2.


Best regards,


Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Level: Powered On

Re: linking 2 sharepoint lists

Thanks guys @v-xida-msft and @Drrickryp for both your replies.  Going to give them a go and see what happens I'll let you know Smiley Happy