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 / Patch vs. Update of Edits
Power Apps
Unanswered

Patch vs. Update of Edits

(0) ShareShare
ReportReport
Posted on by 5,325 Super User 2025 Season 2

I have 'EditForm1'.

I have two buttons - 'Save Draft' and 'Submit'. In each button is the variable varPressed.
     - Save Draft button: UpdateContext({varPressed: "In Draft"});
     - Submit button: UpdateContext({varPressed: "Submit Update"});

There are several fields and controls I want evaluated for 'Save Draft' or 'Submit'

When I access an existing item and make a change, but don't complete the form, and use the 'Save Draft' button Power Apps creates another version of the item rather than overwriting the changes. I believe I need to add an 'If' that compares the List 'ItemID' to the 'ID' in EditForm1, but I am not sure where or how.

In the 'OnSuccess' of EditForm1 I have the following 'Switch' command.

Switch(
       varPressed,
       "In Draft",
       Patch(
              'TrackerList',
              {Status: {Value: "In Draft"}},

      "Submit Update",
      If(
          CombBox1.Seleted.Value = "In Draft" && Label6_3.Text = "Yes" && DataCardValue7_9.Selected.Value = "Other",
          Patch(
                'TrackerList',
                {Status: {Value: "Pending Approval"}})

Categories:
I have the same question (0)
  • SpongYe Profile Picture
    5,603 Super User 2025 Season 2 on at

    Hi @Phineas 

     

    The Patch function in "In Draft" is not completed:

    Your missing a ")" at the end of the line and ThisItem as a reference to the record to update. 

     

     

     

    Switch(
     varPressed,
     "In Draft",
     Patch(
     'TrackerList', ThisItem,
     {Status: {Value: "In Draft"}}),
    
     "Submit Update",
     If(
     CombBox1.Seleted.Value = "In Draft" && Label6_3.Text = "Yes" && DataCardValue7_9.Selected.Value = "Other",
     Patch(
     'TrackerList',
     {Status: {Value: "Pending Approval"}})

     

     

     

     Please try this and see if this works.

     


    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at

    Probably because I have three more similar 'If' conditions in the "Submit Update" part of the switch.

    The statement ends with -
                )
           )
        )
    );

    There are no errors in the formula, it's just not updating the existing 'item', it is creating a new one with the same data with the 'Status' or 'In Draft'.

  • SpongYe Profile Picture
    5,603 Super User 2025 Season 2 on at

    @Phineas 

     

    Please change your patch and add ThisItem as a reference to the record:

    From

    Patch(
     'TrackerList',
     {Status: {Value: "In Draft"}}),

    To

     "In Draft",
     Patch(
     'TrackerList', ThisItem,
     {Status: {Value: "In Draft"}}),

     

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard