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 / Activating the flow in...
Power Apps
Unanswered

Activating the flow in OnSuccess before the form reset its default values

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have SharePoint list which is updated through PowerApps.

I have an edit form which either created new records or edits existing records.

I have a fairly simple flow: PowerApps -> Mail (it asks for To:, Subject:, Body:, and CC: in PowerApps)

In the form I have a field which is Manager (in SharePoint list its People/Group field)

Here is the formula for ManagerField Default property:

If(
    FormType="Edit",
    ThisItem.FirstApprover,
    {
        '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:Concatenate("i:0#.f|membership|",Manager.Mail),
        Department:Manager.Department,
        DisplayName:Manager.DisplayName,
        Email:Manager.Mail,
        JobTitle:Manager.JobTitle,
        Picture:""
    }
)

 

FormType is context variable and it is either Edit (for when the people are editing an record) or New for when people are creating record.

So, when people are editing a record, the Manger field populates with what is already set. If this is a new record, the filed populates with Manager variable (which is a collection and takes info from Office365.Users).

I want to send an email after there has been an edit or new record was created. So, on the EditForm OnSuccess property I have this function:

 

 

If(
    FormType="New",
    'TravelRequestAPP-Version2'.Run("MYEMAIL@MYCOMPANY.COM","TEST NEW",ManagerField.Selected.Email," MYEMAIL@MYCOMPANY.COM ");
    Navigate(MyTravelRequestList,ScreenTransition.Fade,{SuccessMessage:"New Request Created"}),
    'TravelRequestAPP-Version2'.Run("MYEMAIL@MYCOMPANY.COM","TEST MODIFY",ManagerField.Selected.Email," MYEMAIL@MYCOMPANY.COM ");
    Back()
)


So basically, if the form is for new record it sends email to my email, with subject TEST NEW, with body of ManagerField Email and CC to my email, and moves to a page where all requests are displayed. If its edit it send email to my email with TEST MODIFY as subject and Manager email.

 

So it all works and I receive the email. However if the user changes the Manager on the New record creation (changes the default manager) and then Submits the form when the OnSuccess fires ManagerField.Selected.Email resets to the default value not the one entered by the user.

 

 

How would you guys activate this flow before the form puts back default values? I could put the flow on the Submit button but then if the record is not created it would still send an email that’s why I wanted to put it on OnSuccess. Is there any way to restrict the form to resetting to default values before OnSuccess function fires, or somehow capture the value user put in before it is reseted to default value?

 

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi MartynasJurkus,

     

    What’s your current situation?

     

    I assume that your flow is triggered by a PowerApps button. Per my understanding, once the form is submitted, the form will put back its default value, so when OnSuccess fires the field will reset to the default value but not the one entered by user.

     

    When you put the flow on the submit button, how did you configure the code?

     

    What kind of record do you want to submit to data source? Not sure if you could consider to combine IF function or others to restrict the data submitted to data source.

     

    Best regards,
    Mabel Mao

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-yamao-msft

     

    I found a work around which I use for now. On the submit button OnSelect I setup a context variables for each user input. If the form is submitted successfully, in the OnSuccess property I use the context variables which do not reset.

     

    Also I do not know if this is posible but maybe there could be a return value when the form is submitted successfully to use like ThisItem with the recently added item, so PowerApps would assign ThisItem to the newly created record in a SharePoint list. Maybe an idea to consider for the future.

  • cortexeo Profile Picture
    24 on at

    Hi @Anonymous

     

    I had the same issue. I generally wanted to compare the value of what was being submitted vs. what the current value was. If the values were different, I would run the flow to update the record.

     

    I used SharePointIntegration1.Selected.FIELDNAME to get the current value and the DataCardValue to get what was being submitted. I had to use the Set() function to store these in the onSave trigger, and it had to run before the SubmitForm() ... Is this essentially how you did it or did you figure out something different?

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

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard