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 / Submit From: Set form ...
Power Apps
Answered

Submit From: Set form to not reset after submit. Not able to reset by button.

(0) ShareShare
ReportReport
Posted on by 18

Hello,

 

I have a form that I do not want every field reset each time I Submit Form with a button.  I have found a way to accomplish this approach.  Problem now is that the form will not reset when I click on a second button to clear/reset the form.  It is locked down to not reset.  I have tried many different combinations of different solutions and none have worked to get the form to override and reset.  Below is my setup.  Any help is highly appreciated.

 

Screen On-Visible property:

Set(currentCDCDelivery,Blank());
Set(currentDISC,Blank());
Set(currentOriginator,Blank());
Set(currentPhone,Blank());
Set(currentEmail,Blank());
Set(currentDiv,Blank());
Set(currentOrd,Blank());
Set(currentShip,Blank());
Set(currentCtry,Blank());
 
Button On-Select property:
SubmitForm(Form1_1);
Set(currentCDCDelivery,Form1_1.LastSubmit.CDCDelivery);
Set(currentDISC,Form1_1.LastSubmit.Title);
Set(currentDISC,Form1_1.LastSubmit.Title);
Set(currentOriginator,Form1_1.LastSubmit.'Discrepancy Originator');
Set(currentPhone,Form1_1.LastSubmit.Phone);
Set(currentEmail,Form1_1.LastSubmit.Email);
Set(currentDiv,Form1_1.LastSubmit.'Div/Dept/Branch');
Set(currentOrd,Form1_1.LastSubmit.'Order');
Set(currentShip,Form1_1.LastSubmit.'Shipment Type');
Set(currentCtry,Form1_1.LastSubmit.Country);
 
ResetForm property to clear form:  Not working
ResetFrom(Form1_1)
 
Thank you,
Doug
Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Doug_Pirtle 

    You're actually fighting a battle that you don't need to fight in PowerApps.

    If you want your form information to stay put without resetting, then you can do this as is with the form depending on the Default Mode of the form.

    If you set the mode to Edit as the default and then have your Item property set to a record you want, then the form will submit and not change.

     

    The trick is you just simply work with the Item property of the form.

    If you set a snapshot variable to your record, then use that in the Item property, you can simply change that as you go.

     

    Now, I am not sure of your purpose for doing this... are you trying to keep the values to then use for another NEW record, or are you just wanting to then re-edit the current record?

     

     

  • Doug_Pirtle Profile Picture
    18 on at

    Thanks for the quick response Randy.

     

    I need to submit multiple lines from an order.  So I want my header order information to hold its values and then reset the line information to use for anotehr new record.  When complete with the all lines I then want to reset the entire form for a new order.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Doug_Pirtle 

    So in that case, I would work with the Item property of the form.

    Keep your form in Edit mode by default.  

     

    Take a snapshot of the record you submit in the OnSuccess action of the form:

       Set(glbCurrentRecord, Self.LastSubmit)

     

    Then in the Item property, set the Item to:

        Patch(Defaults(yourDataSource), {yourColumn1: glbCurrentRecord.yourColumn1, etc...})

     

    This will give you a new record with the column values from the prior submit that you want.

     

    Finally in the OnReset action of your form, set the formula to:

       Set(glbCurrentRecord, Blank())

     

    This will give you the ability you want.

     

    If you want to be a little "smoother" on the assignment of the columns, then I would modify the OnSuccess action formula mentioned above to:

    Set(glbCurrentRecord,
     First(
     ShowColumns(Table(Self.LastSubmit),
     "CDCDelivery",
     "Title", 
     "Discrepancy Originator",
     "Phone",
     "Email",
     "Div/Dept/Branch",
     "Order",
     "Shipment Type",
     "Country"
     )
     )
    )
    
    
    
    

    Then change your Item property on the form to:

        Patch(Defaults(yourDataSource), glbCurrentRecord)

     

    This is a little easier than working with the repetition of the variable name in the Patch statement.

     

     

  • Doug_Pirtle Profile Picture
    18 on at

    Randy,

    Most everything works, but I am having some issues with the patch function.  There are columns when added that will not accept the patch logic.  I have three dropdowns that are set as choice in my SP list.  Then the Discrepancy Orginator column is text like most of the others and will not take.  What I am doing wrong here.  I have used patch many times before but not with the glbCurrentRecord.  Below is my Patch statement, dropdowns are italicized, the rest are text.

     

    Patch(Defaults(CDCResponseTrackerTest), {Title:glbCurrentRecord.Title,Phone:glbCurrentRecord.Phone,Email:glbCurrentRecord.Email,CDCDelivery:glbCurrentRecord.CDCDelivery,'Div/Dept/Branch':glbCurrentRecord.'Div/Dept/Branch','Discrepancy Type':glbCurrentRecord.'Discrepancy Type','Discrepancy Originator':glbCurrentRecord.'Discrepancy Originator','Shipment Type':glbCurrentRecord.'Shipment Type',Country:glbCurrentRecord.Country})

     

    Thanks,

    Doug

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Doug_Pirtle 

    So, type matching should not be an issue if you have set the glbCurrentRecord variable to the LastSubmit as the record schema will match the Defaults and the Datasource.

    So, if you are seeing an error on those, what is the error that is coming up?

     

  • Doug_Pirtle Profile Picture
    18 on at

    I have the form OnSuccess set to, Set(glbCurrentRecord, Self.LastSubmit).  The error is on the item is 'Invalid formula.  Expected a value compatible with DataSource'.  If I only include Title, CDCDelivery, Phone, and Email the form works as expected.  As soon as I add any of the other columns it does not.  I am allowing the autoselect work when building the formula.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Doug_Pirtle 

    Change your OnSuccess action formula to the following:

     

    Set(glbCurrentRecord,
     First(
     ShowColumns(Table(Self.LastSubmit),
     "Title", 
     "Phone", 
     "Email", 
     "CDCDelivery", 
     "Div/Dept/Branch", 
     "Discrepancy Type", 
     "Discrepancy Originator", 
     "Shipment Type", 
     "Country"
     )
     )
    )

     

     

    And your Item property to:  Patch(Defaults(CDCResponseTrackerTest), glbCurrentRecord)

  • Doug_Pirtle Profile Picture
    18 on at

    So I have set these values and the item property looks good.  However, it seems to be that the column names are still an issue.  ShowColumns has invalid arguments and the same columns do not exist.  It says for "Discrepancy Originator" that column "Discrepancy_X0200_Originator" is has the most similar name.  The DefaultMode is in FormatMode.Edit.  All of these columns are set in the SP List as Single Line of Text.  Either way I try the form OnSuccess and Item functions it seems to be the same result.

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Doug_Pirtle 

    Ah yes...you need to provide the Real column names in your ShowColumns.  Take the suggestion it has in the formula editor and if that is not good, then you need to get the real column name from your list.  You can find the real column name in your list settings by clicking on the column name to see its settings.  The real column name will then be at the end of the URL - you will see Field=xxxxx where xxxxx is the real column name.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard