I'm using PowerApps email template and I'm having trouble with clearing the attachments once the email has been sent. If a user wants to submit another email for another request type immediately after submittal of the first request, when they return to the form, the previous attachments are still present. The current code on the send button is as shown below. Is there something in it I need to tweak in order to get the attachments to clear on send?
/*Create semicolon separated list of people to email, send the email, reset subject & message fields*/
Set(_emailRecipientString, Concat(MyPeople, Mail & ";"));
Office365Outlook.SendEmailV2(_emailRecipientString, TextEmailSubject2.SelectedText.Value, RTEBody.HtmlText, {Attachments: RenameColumns(Attach.Attachments, "Value", "ContentBytes"),Importance:"Normal"});
Reset(TextEmailSubject2);
Reset(RTEBody);
Clear(MyPeople); Navigate(SuccessEmailAlaCarte, ScreenTransition.Fade)
@MarkBandR You are marvelous! That worked. I was just trying the Reset property but I only go so far as changing it from false to true and that wasn't working! I appreciate you! Have a wonderful day! 🙂
Hi @ShondaT
I just tested the following and it worked for me. Please put the following code in your button from the Landing screen right before the Navigate:
Set(varResetAttach,true);
Set(varResetAttach,false);
For your Attachment control, find the "Reset" Property.
Set it to:
varResetAttach
Flipping this variable to true then false will cause the Reset Event to fire.
-Mark
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@MarkBandR thank you for your response. Adding Blank() to the control's Items property didn't appear to work. I went to the link you provided and needed to ask the following question:
@v-yutliu-msft how would I get this to work so that my user doesn't have to push a button on the form. I have a navigation button on another screen that navigates to the email template which I copied the attachment card to. If there is code that I could add to the button on the app's landing page that would remove the attachments that would be the best experience for my users. The current code on the button, a screenshot of the landing page, and a screenshot of the email screen are below:
Navigate(EmailAlaCart, ScreenTransition.Fade)
Hi @ShondaT ,
If you need it to be empty every time the form is open, you could try setting the "Attach" control's Items property to:
Blank()
If that does not work, take a look at this post:
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional