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 / Patch function need He...
Power Apps
Answered

Patch function need Help please

(0) ShareShare
ReportReport
Posted on by 116

Hello,

I need help in the usage of the Patch function please.

My goal is to override a field in a database table with the value "not available"  if another field is not empty. 

 

This shall happen after a form is submitted and the code I have so far is on the Onselect Property of a button:

UpdateContext({EME_MitarbeiterVar:DataCardValue56});
SubmitForm(EditMitarbeiterEinheitForm);
If(EME_MitarbeiterVar <> "", Patch(Einheit, Defaults(Einheit), {Status:"Vergeben"}));
Back();

 

I am not quit sure also how I can define the dataset I want to update in the Patch function because I think like this it would override all datasets, doesnt it?

Any help is much appreciated!

best regards Leon

Categories:
I have the same question (0)
  • Verified answer
    Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi

    Plz try this

    UpdateContext({ EME_MitarbeiterVar: DataCardValue56 });
    SubmitForm(EditMitarbeiterEinheitForm);

    If(EME_MitarbeiterVar <> "",
    Patch(
    Einheit,
    LookUp(Einheit, YourConditionHere),
    { Status: "Vergeben" }
    )
    );

    Back();

    (Or)

    UpdateContext({EME_MitarbeiterVar:DataCardValue56}); SubmitForm(EditMitarbeiterEinheitForm); If(!IsBlank(EME_MitarbeiterVar), Patch(Einheit, LookUp(Einheit, ID = EditMitarbeiterEinheitForm.LastSubmit.ID), {Status:"not available"})); Back();


    Thanks!

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

  • Xeon0021 Profile Picture
    116 on at

    Hello @Rajkumar_404 ,

    thanks a lot, the second option is working for me!!

    best regards

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard