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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / how to route record to...
Power Apps
Suggested Answer

how to route record to be added to multiple SharePoint List

(0) ShareShare
ReportReport
Posted on by 819 Moderator
Good Morning Team,
 
I build Power app for Production Issue Tracking(before only SharePoint site 1 was added to the app, later SharePoint site 2 is being added to the app so that records can be added to 
Our business requirement is - to add record to two Sharepoint list based on Location selection.
 
For example - 
Location A - record should be added to SharePoint 1
Location B - record should be added to SharePoint 2
 
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    69,556 Most Valuable Professional on at
    Assuming that this is a Canvas app and there is code behind the green check icon in hte upper right to commit the record using either a submitForm() or a Patch().  If that is the case just change the code in the OnSelect for the green check to add an if() based on condition that Patches the correct list.  There won't be a way to do it with Submit form, because a form is bound to a single data source (list).

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Suggested answer
    Mahesh Birudu Profile Picture
    28 on at
    Here is the step by step process

    Srep1: Button select property: 
     
    Switch(
        location_Datacard.Selected.Value,
     
        "India",
        Patch(
            Location2,
            Defaults(Location2),
            {
                Title: DataCardValue1.Text
            }
        ),
     
        "USA",
        Patch(
            Location1,
            Defaults(Location1),
            {
                Title: DataCardValue1.Text,
                Location: { Value: location_Datacard.Selected.Value },
                Lists: { Value: "Site1_Location1" }
            }
        ),
     
        "UK",
        Patch(
            Location2,
            Defaults(Location2),
            {
                Title: DataCardValue1.Text
            }
        )
    )

    Step2:
    In the Lists control DefaultSelectedItems property, you can use the following logic:
     
    Switch(DataCardValue2.Selected.Value,"India",{Value:"Site2_Location2"},"USA",{Value:"Site1_Location1"})
     
    Note: The Lists dropdown is used solely for routing the form. Its value is automatically determined based on the selected location. Therefore, it should be configured to map accurately according to your business requirements.

     
     
  • Suggested answer
    Kalathiya Profile Picture
    2,456 Super User 2026 Season 1 on at
    Hello @MTNK
     
    SubmitForm won’t work in this scenario because it is tied to a single data source. Instead, you can use the Patch() function. Using Patch, you can dynamically choose the data source depending on the selected Location and create the record accordingly.
     
    Approach 1
     
    Example: 
    In this example, we’re just switching the SharePoint list based on the selected Location. The Patch() function code remain the same, we’re only changing the data source.
    If(ComboBox2.Selected.Value = "Location A", //ComboBox2 - Replace with your combobox name
        Set(g_SharePointList,Test3);, //Test3 - Site 1 List Name
        Set(g_SharePointList,Test3_1) //Test3_1 - Site 2 List Name
    ); 
    Patch(g_SharePointList, 
        Defaults(g_SharePointList), 
            {
                DueDate:Today()   //Column names and value - Make sure to use internal column naming conversation. 
            }
    );
    Note: This assuming both SharePoint lists have the same column naming conversations.
     
    Approach 2
     
    Example:
    If SharePoint column naming conversation are different in both sites then use below approach:
    Switch(ComboBox2.Selected.Value, 
        "Location A", 
            Patch(g_SharePointList, 
                Defaults(g_SharePointList), 
                    {
                        DueDate:Today()
                    }
            );, 
        "Location B",
           Patch(g_SharePointList, 
                Defaults(g_SharePointList), 
                    {
                        DueDate:Today()
                    }
            );
    );
     
     
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
    ---------------------------------------------------------------------------------

    📩 Need more help? Just mention @Kalathiya and I’ll be happy to assist.

    ✔️ If this answer helped you, please tick “Does this answer your question?” so it can be marked as the Verified Answer.

    💛 A Like always motivates me to keep contributing!

     
     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard