Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Clearing Attachments when Using the Email Template

(0) ShareShare
ReportReport
Posted on by 228

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)

 

2023-09-01_8-23-43.jpg

  • ShondaT Profile Picture
    228 on at
    Re: Clearing Attachments when Using the Email Template

    @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! 🙂

  • Verified answer
    MarkRahn Profile Picture
    973 Super User 2025 Season 1 on at
    Re: Clearing Attachments when Using the Email Template

    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.

  • ShondaT Profile Picture
    228 on at
    Re: Clearing Attachments when Using the Email Template

    @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)

     

    2023-09-05_11-42-02.jpg

     

    2023-09-01_8-23-43.jpg

  • MarkRahn Profile Picture
    973 Super User 2025 Season 1 on at
    Re: Clearing Attachments when Using the Email Template

    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:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Possible-to-clear-attachments-when-editing-a-form/td-p/648621

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard