web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Reset attachment contr...
Power Apps
Unanswered

Reset attachment control after sending email

(1) ShareShare
ReportReport
Posted on by 71
Good day beautiful people,
 
Office365Outlook.SendEmailV2(
    LookUp(
        DeveloperInfo,
        Name = "Developer"
    ).Email,
    "Subject: Bug report",
    "Reported by " & User().FullName & ": " & 'txt:Bug_Description'.Value,
    {
        Attachments: ForAll(
            'Atch:Attachment'.Attachments,
            {
                ContentBytes: Value,
                Name: Name
            }
        )
    }
);
Notify(
    "Success",
    NotificationType.Success
);
Reset('txt:Bug_Description');
/* Reset('Atch:Attachment'); */
/* Timer1.Start; */
 
The error I receive with above code is: Parameter Attachment Content cannot be null or empty.
As you can see, in the end of the code I have tried two separate ways to reset this control:
  • Reset('Atch:Attachment')
  • Timer1.Start and OnTimerEnd: Reset('Atch:Attachment');
Where both failed with the same error.

Is it correct approach to reset the control?
 
 
Edit:// Without Reset, Timer1 everything is working perfectly.
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at
    Hi   ,
    You can certainly reset an attachment control, assuming it is not in a Form. If it is in a Form, use
    UpdateContext({varReset: false});
    UpdateContext({varReset: true});
    then the Default of the Attachment control 
    varReset
    however there may be something else involved here judging by the error message, which refers to a Parameter, which is not mentioned in your post.
  • Copycat Profile Picture
    71 on at
    I'm lost with this new community UI so I can't find a reply to button, but anyway:
     
    - Container:Report_bug:
        Control: GroupContainer
        Variant: manualLayoutContainer
        Properties:
          Visible: =showReportBug
        Children:
        - lb:Information:
            Control: Text
            Properties:
              Align: ='TextCanvas.Align'.Center
              Text: ="Please use ""Submit a report"" functionality to report application bugs only. Data errors should be reported via standarized way."
              Weight: ='TextCanvas.Weight'.Semibold
              Height: =50
              Width: =1064
              X: =Parent.Width / 2 - Self.Width / 2
              Y: =36
        - btn:Submit_Bug:
            Control: Button
            Properties:
              OnSelect: |
                =Office365Outlook.SendEmailV2(
                    LookUp(
                        DeveloperInfo,
                        Name = "Developer"
                    ).Email,
                    "Subject: Bug report",
                    "Bug reported by " & User().FullName & ": " & 'txt:Bug_Description'.Value,
                    {
                        Attachments: ForAll(
                            'Atch:Attachment'.Attachments,
                            {
                                ContentBytes: Value,
                                Name: Name
                            }
                        )
                    }
                );
                Notify(
                    "Your report has been submitted, thank you.",
                    NotificationType.Success
                );
                Reset('txt:Bug_Description');
                /* Reset('Atch:Attachment');*/
              Align: =Align.Justify
              Appearance: ='ButtonCanvas.Appearance'.Primary
              Text: ="Submit report"
              DisplayMode: =If(IsBlank('txt:Bug_Description'.Value), DisplayMode.Disabled, DisplayMode.Edit)
              Height: =49
              Width: =120
              X: =Parent.Width / 2 - Self.Width / 2
              Y: =342
        - Atch:Attachment:
            Control: Attachments
            Properties:
              OnAddFile: =true
              MaxAttachmentSize: =2
              MaxAttachments: =2
              Tooltip: ="Maximum 3 attachments"
              BorderColor: =RGBA(214, 221, 224, 1)
              BorderStyle: =BorderStyle.Solid
              BorderThickness: =4
              Color: =RGBA(0, 0, 0, 1)
              DisabledBorderColor: =RGBA(166, 166, 166, 1)
              Fill: =RGBA(255, 255, 255, 0.72)
              FocusedBorderThickness: =4
              Font: =Font.'Open Sans'
              Height: =124
              HoverColor: =RGBA(0, 0, 0, 1)
              HoverFill: =RGBA(186, 202, 226, 1)
              ItemColor: =RGBA(255, 255, 255, 1)
              ItemFill: =RGBA(56, 96, 178, 1)
              ItemHoverColor: =RGBA(0, 0, 0, 1)
              ItemHoverFill: =RGBA(186, 202, 226, 1)
              ItemSpacing: =0
              NoAttachmentsColor: =Self.Color
              PaddingBottom: =5
              PaddingLeft: =If(Self.DisplayMode = DisplayMode.Edit, 5, 0)
              PaddingRight: =3.75
              PaddingTop: =3.75
              PressedFill: =RGBA(0, 18, 107, 1)
              Size: =14.99
              Width: =460
              X: =Parent.Width / 2 - Self.Width / 2
              Y: =192
        - txt:Bug_Description:
            Control: FluentV8/TextBox
            Properties:
              Placeholder: ="Please provide accurate description"
              Value: =
              Height: =40
              Width: =600
              X: =Parent.Width / 2 - Self.Width / 2
              Y: =123
    
    I have attached whole container code (where the att control is included), so there is a clear visibility of what is going there.
     
    Screen overall is simple:
    • Title Label
    • Text Input
    • Attachment field
    • Button (button code attached in 1st post)
    No matter what I do and what I try, smallest modification of Reset functionality causes an error (var, timers and so on).
    I did a check and it is working if a attachment field is a part of a form but in my case, where I want to send an mail it is not - is there a possibility that this is Power App limitation?
     
     
    I also tried this solution found in web:
    Modified maximum attachment to 1 and updated button to:
    {
            Attachments: If(
                CountRows('Atch:Attachment'.Attachments) > 0,
                {
                    ContentBytes: First('Atch:Attachment'.Attachments).Value,
                    Name: First('Atch:Attachment'.Attachments).Name
                },
                Blank()
            )
        }
    But it's still angry.
  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at
    If you are using modern controls, please try with Classic items

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard