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 / Send email only once w...
Power Apps
Answered

Send email only once when form is submitted.

(0) ShareShare
ReportReport
Posted on by 555

Hi,

I am trying to send an email ONLY ONCE when a form is submitted by a user regardless of the times he hit on the Submit button?

 

My current situation:

  • User edits a form and hits submit.
  • An email will be sent automatically to the designated recipient through combobox selected.
  • User comes back to edit some few fields, enters the info, and hits the Submit button.
  • if email is already sent no email should be sent again, if they change the person in combobox then it should it send email.

I have tried the following these steps and it dosnt work as expected.

OnVisible screen:

Set(emailSent,false)

OnSuccess of form:

If(emailSent = false,
 Office365Outlook.SendEmailV2(
 Concat(
 ComboBox4.SelectedItems,
 Mail & ";"
 ),
 "New Project assigned",
 "Hi you are assigned with new project, please review the project detail <a href='Sharepoint site URL =" & BrowseGallery1.Selected.ID & "& e=CP4kmH'> Click link for details</a>'",
 {From: "applicationdevelopment@flexicare.com"}
 );
 Set(emailSent, true)

Submit button:

SubmitForm(Form1);
Navigate(Homescreen);Reset(TextSearchBox1)

 

It did send email for the first submit, but when i came back and edited few fields and clicked on submit, it gave me a error message and the combobox resets to blank.

 

Cr1t_0-1681458732752.png

 

 

Is there a way that only one email will be sent to the user?

 

I would like to prevent bombarding emails to the recipients.

 

Thank you. 

 

@WarrenBelz @BCBuizer @LaurensM @Drrickryp @NandiniBhagya20 @CNT 

Categories:
I have the same question (0)
  • Mx81 Profile Picture
    860 on at

    If you leaving the screen every time you press the submit button and afterwards setting the emailSent variable to false: every time an email will be send.

     

    My suggestions: remove 

    Set(emailSent,false)

     from Screen.OnVisible.

    And don't do it with a variable in your app.

    Create a new column in your SharePoint list with emailSent information. I'm normally patch there a datetime value.

    So if this field is empty (blank) : send email.

    If the field is not empty (blank): don't send email

  • Cr1t Profile Picture
    555 on at

    @max81 

    Thanks for the reply, i tried to implement the solution dosnt seem to work.

    Created Yes/No column as Email Sent in SP. 

    On submit button 

    If(
    IsBlank(ThisItem.'Email Sent'),
    Office365Outlook.SendEmailV2(
    Concat(
    ComboBox4.SelectedItems,
    Mail & ";"
    ),
    "New Project assigned",
    "Hi you are assigned with new project, please review the project detail <a href='SharePoint URL ?ID=" & BrowseGallery1.Selected.ID & "& e=CP4kmH'> Click link for details</a>'",
    {From: "applicationdevelopment@flexicare.com"}
    );
    Patch('[Testing] Global Registration Tracker',BrowseGallery1.Selected,{'Email Sent':true});
    SubmitForm(Form1);
    Navigate(Homescreen);
    Reset(TextSearchBox1);
    )


    Issue: After i put is blank the button does not work at all.

    So I taught first let me update the Yes/No column to yes once email sent.

    Office365Outlook.SendEmailV2(
     Concat(
     ComboBox4.SelectedItems,
     Mail & ";"
     ),
     "New Project assigned",
     "Hi you are assigned with new project, please review the project detail <a href='Sharepoint URL?ID=" & BrowseGallery1.Selected.ID & "& e=CP4kmH'> Click link for details</a>'",
     {From: "applicationdevelopment@flexicare.com"}
    );Patch('[Testing] Global Registration Tracker',BrowseGallery1.Selected,{'Email Sent':true});
    SubmitForm(Form1);
    Navigate(Homescreen);
    Reset(TextSearchBox1);

    With this code it does not update the column to yes, i only receive email but when i edit again combobox resets to blank.

     

    Please help, thank you.

  • BCBuizer Profile Picture
    22,844 Super User 2026 Season 2 on at

    Hi @Cr1t ,

     

    I suggest to get rid of the variable and set a condition for the Form1.Mode property to only send when it is FormMode.New:

     

    If(Form1.Mode=FormMode.New,
     Office365Outlook.SendEmailV2(
     Concat(
     ComboBox4.SelectedItems,
     Mail & ";"
     ),
     "New Project assigned",
     "Hi you are assigned with new project, please review the project detail <a href='Sharepoint site URL =" & BrowseGallery1.Selected.ID & "& e=CP4kmH'> Click link for details</a>'",
     {From: "applicationdevelopment@flexicare.com"}
     )
    );

     

     

  • Cr1t Profile Picture
    555 on at

    @BCBuizer 
    Thanks for reply, I applied the changes you gave me. so from gallery i selcted the recored i newly created, then i clicked the edit icon it takes me to edit page so i can assign user to that record. I assigned the user and clicked on submit it did not send me email only updated to sharepoint list.

    Cr1t_0-1681470409668.png

     

    Cr1t_1-1681470434783.png

     


    So i changed the code to:

    If(Form1.Mode=FormMode.Edit,
    Office365Outlook.SendEmailV2(
     Concat(
     ComboBox4.SelectedItems,
     Mail & ";"
     ),
     "New Project assigned",
     "Hi you are assigned with new project, please review the project detail <a href= SharePoint URL ID=" & BrowseGallery1.Selected.ID & "& e=CP4kmH'> Click link for details</a>'",
     {From: "applicationdevelopment@flexicare.com"}
    );)

     

    It sent me email properly but if i changed any other vlaues and clicked on submit again, the combox box resets it value to blank. dont know what to do here.

     

  • BCBuizer Profile Picture
    22,844 Super User 2026 Season 2 on at

    Hi @Cr1t ,

     

    Sorry, I didn't read your opening post thoroughly enough previously, so please ignore my previous suggestion.

     

    So what you are saying is that no mail should be sent out upon form submission unless the selected items in ComboBox4 have changed, correct?

     

    I would save the value of the selected items in ComboBox4 in a variable for that and compare that against the selection at the time of submitting the form.

     

    OnVisible screen:

    Set(emailSent,Concat(ComboBox4.SelectedItems, Mail, ";"))

    OnSuccess of form:

    If(Concat(ComboBox4.SelectedItems, Mail, ";") <> emailSent,
     Office365Outlook.SendEmailV2(
     Concat(
     ComboBox4.SelectedItems,
     Mail,
     ";"
     ),
     "New Project assigned",
     "Hi you are assigned with new project, please review the project detail <a href='Sharepoint site URL =" & BrowseGallery1.Selected.ID & "& e=CP4kmH'> Click link for details</a>'",
     {From: "applicationdevelopment@flexicare.com"}
     );
     Set(emailSent, Concat(ComboBox4.SelectedItems, Mail, ";"))

    Submit button:

    SubmitForm(Form1);
    Navigate(Homescreen);Reset(TextSearchBox1)

     

    Please note that if an additional person gets added, still all selected persons will receive a mail.

     

    A question though, since you mentioned ComboBox4 is resetting. What is the DefaultSelectedItems property of ComboBox4?

  • Cr1t Profile Picture
    555 on at

    @BCBuizer 

    Ill explain this again.

    Step 1: They fill out this form and the data saves into my SP list.

    Cr1t_0-1681487728579.png

    Step 2: Now they want to assign this project to a person so they can work on it, so i have a gallery connected to SP which has all the entries.

    Cr1t_1-1681487846779.png

     

    Step 3: They select their entry, go to edit screen and search for the user they want to assign the project and submit the data. 

    Cr1t_3-1681488288461.png

    Now user assigns the project, email goes to selected user, first step works fine.

    But, if user comes back to the same row updates other rows like changes date etc. and clicks on submit. 

    1. The combobox4 resets to blank and it gives the office 365 error.

    2. I wanted to way to make sure it sends email only once if an email already sent and save only the changes to SP list.

    3. If in case they change their mind and only if they change the person in assign to field, the button should detect it and send email if not it should not send email, can this be achieved? 

     

    Edit screen has a combo box. 
    Items: 

    Office365Users.SearchUser({top:999})

    Defaultselecteditems: 

    {Value:ThisItem.'Assign to '}

    Uptdate of datacard is:

    ComboBox4.Selected.DisplayName

    form on success:

    Office365Outlook.SendEmailV2(
     Concat(
     ComboBox4.SelectedItems,
     Mail & ";"
     ),
     "New Project assigned",
     "Hi you are assigned with new project, please review the project detail <a href='Sharepoint URL ID=" & BrowseGallery1.Selected.ID & "& e=CP4kmH'> Click link for details</a>'",
     {From: "applicationdevelopment@flexicare.com"}
    );)

    Submit button:

    SubmitForm(Form1);
    Navigate(Homescreen);
    Reset(TextSearchBox1);

     

     

  • BCBuizer Profile Picture
    22,844 Super User 2026 Season 2 on at

    Hi @Cr1t ,

     

    The issue with the combobox resetting is because of how you have set up the 'Assign To ' column as a Text type, but still trying to populate it as if it were a Person type. 

     

    I suggest you change the 'Assign To' column to a Person type, remove and then add back the data card and continue working on your original topic from there.

  • Cr1t Profile Picture
    555 on at

    @BCBuizer 

    Okay I have done the changes, i added a new person column. put the same items property and button and onsucess form as well. I received the email for it. 

    What should the defaultselecteditem be now, because once the form submits and i open the record from gallery again, the value from the assign to field disappears. 

    Currently the defaultselecteditem is 

    Parent.Default

     

  • BCBuizer Profile Picture
    22,844 Super User 2026 Season 2 on at

    HI @Cr1t ,

     

    Did you remove and add back the data card? This should reset everything so all properties of the DataCard and DataCardValue should be set to work correctly.

     

    DataCardValue.DefaultSelectedItems should indeed be Parent.Default, where it references DataCard.Default. That should be set to ThisItem.'Assigned To' (or whatever the name of the column is now).

  • Cr1t Profile Picture
    555 on at

    Yes I completely added a new person column. Sorry did not understand where should i put ThisItem.AssignTo.

    Cr1t_0-1681502833746.pngCr1t_1-1681502851641.pngCr1t_2-1681502879030.pngCr1t_3-1681502900851.png

     

    This is default of datacard

    Cr1t_4-1681502974966.png

    Update of datacard

    Cr1t_5-1681502996971.png

    I am getting emails but the data card does not hold value after submit.

     

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

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard