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?