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 Submit Data to ...
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!

Categories:
I have the same question (0)
  • Suggested answer
    Trait007 Profile Picture
    310 on at

    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
    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
    37,205 Super User 2026 Season 1 on at
    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

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 387

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 301

Last 30 days Overall leaderboard