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 / Saving two records at ...
Power Apps
Unanswered

Saving two records at once via Patch

(0) ShareShare
ReportReport
Posted on by 8

Hello!

 

I need some direction please?  I have a Patch function that is saving a record to a SQL table successfully.  I have been asked to create two records at once for employees who will be swapping job positions.  So, one employee who was working as a teacher with a similar job description will be trading places with another.  I need to save employee ID, F,M,L name, Location, etc. This will be two brand new records that I am capturing the data for through LookUps across multiple screens.  What would be the best approach to accomplish this?  Bonus points for working examples.    🙂

 

Set(VarReturn, Patch(
DataSource,
Defaults(DataSource),
{
TransEmpID: dcEmpID_1.Text,
Location: lblddlLocationFilterSelection.Text,
LocationNumber: lblEmpLocationCode.Text,
TransEmpFName: dcFName_2.Text,
TransEmpMName: dcMInitial_2.Text,
TransEmpLName: dcLName_1.Text,
TransEmpEmail: dcEmail_1.Text,
EmpBargUnit: txtBU_1.Text,
EffectiveDate: dcEffDate_4.SelectedDate,
TransToPosNum: Proper(ddlJobDesc_2.Selected.pmpc_position),
TransToJobDesc: Proper(ddlJobDesc_2.Selected.prjb_long),
PASubmittedForReplacedEmp: rdoPAAlreadySubmitted.Selected.Value,
ReasonForChange: ddlPAReason_1.Selected.Value,
PANotes: dcNotes_4.Text,
ManagerEmail: lblHMEmail.Text,
ApprovalStatus: lblApproval_Status_1.Text,
TransFullName: txtfullname_1.Text,
TransEmpMstrCurrentJobNo: lblCurrentPosNum.Text,
TransEmpMstrCurrentJob: txtEmpMstrJob_1.Text,
PATimeStamp: Now()
}
) );

VarReturn.ID; <--Using to upload files to SharePoint with employee Metadata in next screen.

Categories:
I have the same question (0)
  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @PA-Unicorn 

     

    In this case, we have 2 options

     

    1. Create another record once the current record is saved using PowerApps

    2. Have Power Automate to create another record based on this record creation

     

    #1. Save 2 records one after other

    Set(VarReturn, Patch(
    DataSource,
    Defaults(DataSource),
    {
    TransEmpID: dcEmpID_1.Text,
    Location: lblddlLocationFilterSelection.Text,
    LocationNumber: lblEmpLocationCode.Text,
    TransEmpFName: dcFName_2.Text,
    TransEmpMName: dcMInitial_2.Text,
    TransEmpLName: dcLName_1.Text,
    TransEmpEmail: dcEmail_1.Text,
    EmpBargUnit: txtBU_1.Text,
    EffectiveDate: dcEffDate_4.SelectedDate,
    TransToPosNum: Proper(ddlJobDesc_2.Selected.pmpc_position),
    TransToJobDesc: Proper(ddlJobDesc_2.Selected.prjb_long),
    PASubmittedForReplacedEmp: rdoPAAlreadySubmitted.Selected.Value,
    ReasonForChange: ddlPAReason_1.Selected.Value,
    PANotes: dcNotes_4.Text,
    ManagerEmail: lblHMEmail.Text,
    ApprovalStatus: lblApproval_Status_1.Text,
    TransFullName: txtfullname_1.Text,
    TransEmpMstrCurrentJobNo: lblCurrentPosNum.Text,
    TransEmpMstrCurrentJob: txtEmpMstrJob_1.Text,
    PATimeStamp: Now()
    }
    ) );
    
    //Patch or Create Another record
    Patch(
    DataSource2,
    Defaults(DataSource2),
    {
    }
    )

     

    #2

    Create Power Automate to create another record.

    Type: Automated Cloud Flow

    Trigger: When an item is created

     

    StalinPonnusamy_0-1637691714021.png

     


    Thanks,
    Stalin - Learn To Illuminate

  • PA-Unicorn Profile Picture
    8 on at

    I am just starting to learn PowerAutomate. I will play around with option one as the learning curve shouldn’t prove as steep for me.

     

    Just so I am clear, excluding employee specific metadata, the job description values for employee one will become the values for employee two and vise versa.

     

    I am currently retrieving via lookup the job info for employee two and saving these values for employee one in my patch function. These save to a different table then where the data is being read from. I will now need to perform a lookup up on employee one so I can save those data for employee two since employee one is swapping jobs with employee two.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard