web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create SP List item in...
Power Apps
Answered

Create SP List item in 2 different lists using 1 button - ( 1st list is the 'Master' & 2nd List has lookup column to the 'Master')

(0) ShareShare
ReportReport
Posted on by

Hi, I have the following code in the 'OnSelect' property of a button;

 

Patch(
    'Master List',
    {
        Column1: ComboBox4.Selected,
        Column2: ComboBox5.Selected, 
        ComponentName: TextInput_ComponentName.Text
    }
);
 
Patch(
    'Lookup List',
    {
        Column1: Label1.Text, 
        Column2: {Value: "TestValue"}, 
        Column3: TextInput1.Text,
        ComponentName: TextInput_ComponentName.Text
    }
)
 
So I am patching (new item) in a list called 'Master List' and all columns are updated successfully. 
 
Then I patch (new item) the second list  'Lookup List'. This list has a lookup column called 'ComponentName' that is related to the column 'ComponentName' in the Master List. The ComponentName in the Look Up list is the only column that is not updated and I think this is because the 2 Patches are run at the same time and the Look Up list ComponentName can't find its corresponding value in the Master List as it thinks it hasn't been created yet. Hope that makes sense.
 
Would anyone have an idea on how to correct this?
 
Thanks
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,452 Most Valuable Professional on at

    Hi @Marty3012 ,

    The Lookup column is making this far more complex than it needs to be (you may not have to use this column type - I never do. Try this

    Patch(
     'Master List',
     {
     Column1: ComboBox4.Selected,
     Column2: ComboBox5.Selected, 
     ComponentName: TextInput_ComponentName.Text
     }
    );
    Patch(
     'Lookup List',
     {
     Column1: Label1.Text, 
     Column2: {Value: "TestValue"}, 
     Column3: TextInput1.Text,
     ComponentName: 
     {
     Value: TextInput_ComponentName.Text,
     Id: 
     LookUp(
     'Master List',
     ComponentName = TextInput_ComponentName.Text
     ).ID
     }
     }
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Marty3012 Profile Picture
    on at

    Thanks, that works! Unfortunately the lookup column is required, but this solution does the job.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 386 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 361

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 339 Super User 2025 Season 2

Last 30 days Overall leaderboard