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 / How to patch from Edit...
Power Apps
Unanswered

How to patch from EditForm.Mode = New ?

(0) ShareShare
ReportReport
Posted on by 829

Hi Folks -

 

I have a PowerApps application with a SharePoint List source.  I have a field called "Element_Type" that I have a default value set to "FALSE".  Upon a new request, I have a dialogue box pop-up and based on their selection of what type of data element they are creating, I need to populate "Element_Type" with a value of "TRUE".

 

How do I use the patch feature to update a new request being submitted to SharePoint? For existing rows it seems easy but directly from a button that isn't associated to a datacard I'm having trouble.

 

I need to update table "rdInvestments" column "Element_Type" to "TRUE" upon a button selection.

 

Can someone help me? THank you!!!

Categories:
I have the same question (0)
  • simms7400 Profile Picture
    829 on at

    Here are the contents of my button:

    Patch(rdInvestments,Defaults(rdInvestments),{Device_Flag:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:1,Value:"TRUE"}});NewForm(InvestmentEditForm) && Navigate(InvestmentEditScreen,ScreenTransition.None);UpdateContext({boolPopUpOwnership: false})

    The above code patches to the list correctly) but it creates a new record, then it nevaigate to the new form and when I submit that, it creates ANOTHER record.

     

    My goal is to change  Device_Flag to TRUE upon navgating to my new form for the new record i'm tryin to create.  As the value of TRUE will drive visibility and required fields.

     

    Thank you!

  • v-xida-msft Profile Picture
    on at

    Hi @simms7400 ,

    Could you please share a bit more about the Device_Flag field in your SP List? Is it a LookUp field or a Choice type field?

    Do you want to update the Device_Flag field of the Submitted record from your form into TRUE value?

     

    Based on the needs that you mentioned, I think there is something with your formula. The Patch formula you provided above could be only used to create a new record in your SP List rather than update existing record.

     

    According to the needs you mentioned, I think the OnSuccess property of the Edit form and Patch function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

    Set the OnSelect property of the "Submit" button to following:

     

    SubmitForm(InvestmentEditForm);
    

    Set the OnSuccess property of the InvestmentEditForm to following:

     

    Patch(
     rdInvestments,
    LookUp(rdInvestments, ID = InvestmentEditForm.LastSubmit.ID),
    {
    Device_Flag: {
    '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id:1,
    Value:"TRUE"
    }
    } );
    NewForm(InvestmentEditForm);
    Navigate(InvestmentEditScreen, ScreenTransition.None);
    UpdateContext({boolPopUpOwnership: false})

    Please consider take a try with above solution, then check if the issue is solved.

    Note: The OnSuccess property of Edit form would be fired when you submit your Edit form data successfully.

     

    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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard