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

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

How to Submit Data to Two Tables in Dataverse with a Single Button (Submit) in PowerApps?

(0) ShareShare
ReportReport
Posted on by 2

Hello,

I am working on a Canvas App in PowerApps and need to submit data into two Dataverse tables (Visitors and Meetings) with a single button click. Here's the desired workflow:

  1. Visitors Table: I use a form (Form1) to collect visitor details and submit it to the Visitors table.
  2. Meetings Table: After successfully submitting the visitor record, I want to create a related meeting record in the Meetings table using the Patch function.

Issue:

The Visitors form (Form1) is submitted successfully, but the record in the Meetings table is not being created. In some cases, I get a generic error message without detailed information.

Here is the current code I am using in the button's OnSelect property
// Submit data to Visitors table
SubmitForm(Form1);
// Check if Visitors form submission is valid
If(
    Form1.Valid,
    // Create a Meeting record
    Set(
        NewMeetingRecord,
        Patch(
            Meetings,
            Defaults(Meetings),
            {
                MeetingDate: DateTimeValue(
                    Text(DateValue1.SelectedDate) & " " & HourValue1.Selected.Value & ":" & MinuteValue1.Selected.Value
                ),
                MeetingDetails: DataCardValue7.Text,
                EmployeeEmail: ComboBox1.Selected.userPrincipalName,
                VisitorsName: DataCardValue5.Text
            }
        )
    );
    // Notify success or failure
    If(
        !IsError(NewMeetingRecord),
        Notify("Visitor and Meeting registered successfully!", NotificationType.Success),
        Notify("Error registering Meeting. Please try again.", NotificationType.Error)
    )
,
    Notify("Error registering Visitor. Please check your input.", NotificationType.Error)
);
// Reset form and navigate to another screen
If(
    Form1.Valid && !IsError(NewMeetingRecord),
    ResetForm(Form1);
    Navigate(EmployeeScreen)
);
 

Question:

How can I properly submit data into two Dataverse tables with one button click? Is there a better approach to handle this workflow or any common pitfalls I might be missing?

Thanks in advance for your help!

I have the same question (0)
  • Suggested answer
    VASANTH KUMAR BALMADI Profile Picture
    266 on at
    How to Submit Data to Two Tables in Dataverse with a Single Button (Submit) in PowerApps?

    Improvement Suggestions:

    • Sequential Flow: You can improve the flow by ensuring that the Meetings record creation only happens if the Visitor is successfully added:
      If(
      Form1.Valid,
      SubmitForm(Form1); // Submit Visitor data
      If(
      !IsError(Form1.LastSubmit), // Ensure Visitor data submission was successful
      Set(
      NewMeetingRecord,
      Patch(
      Meetings,
      Defaults(Meetings),
      {
      MeetingDate: DateTimeValue(
      Text(DateValue1.SelectedDate) & " " & HourValue1.Selected.Value & ":" & MinuteValue1.Selected.Value
      ),
      MeetingDetails: DataCardValue7.Text,
      EmployeeEmail: ComboBox1.Selected.userPrincipalName,
      VisitorsName: DataCardValue5.Text
      }
      )
      );
      If(
      !IsError(NewMeetingRecord),
      Notify("Visitor and Meeting registered successfully!", NotificationType.Success),
      Notify("Error registering Meeting. Please try again.", NotificationType.Error)
      ),
      Notify("Error registering Visitor. Please check your input.", NotificationType.Error)
      )
      );
      This ensures the Meetings record is created only after the Visitor record is successfully submitted.

    By structuring the logic this way, you ensure that both records are successfully created and provide meaningful notifications to the user for both the Visitor and Meeting data submissions.

  • NV-31120454-0 Profile Picture
    2 on at
    How to Submit Data to Two Tables in Dataverse with a Single Button (Submit) in PowerApps?
    Thank you @VASANTH KUMAR BALMADI I have tried your approach but it is showing error even though i have filled all required fields !
    Error registering Meeting. Please try again.
  • Suggested answer
    timl Profile Picture
    35,805 Super User 2025 Season 2 on at
    How to Submit Data to Two Tables in Dataverse with a Single Button (Submit) in PowerApps?
    Hi NV-31120454-0 
     
    Can you clarify where you added the meeting controls such as DataCardValue5 and DataCardValue7?
     
    Are they on Form1? If that's the case, the probable cause of the problem is that after submitting Form1, the form values are reset and won't be available when you patch to the Meetings table.
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 652 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 410 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 236

Last 30 days Overall leaderboard