Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Counting Attachments to enable a button

(1) ShareShare
ReportReport
Posted on by 117

Hi everyone,

 

I need to enable a button based on the count of attachments. If the attachment datacard is not in a form it works but I can't get the value from the datacard property when it's in the form. I'm using countrows - is there another way to achieve this?

DSFlemming_0-1641511459962.png

 

  • blaze4fun Profile Picture
    blaze4fun 13 on at
    Re: Counting Attachments to enable a button

    That's awesome...and a better workaround than using OnChange (which didn't work with a person lookup).

    Seems to work when editing an existing record by doing NewForm(), getting the record, then EditForm()...or, even easier, just set the form's DefaultMode property to FormMode.New.

     

    I just received an email from Microsoft regarding my issue.  They're still working on it....

    You saved the day!  Maybe this will help them. 😉

     

  • DSFlemming Profile Picture
    DSFlemming 117 on at
    Re: Counting Attachments to enable a button

    Agreed. It solves my issue but it's still going to be a problem. 

  • WarrenBelz Profile Picture
    WarrenBelz 145,580 on at
    Re: Counting Attachments to enable a button

    Hi @DSFlemming ,

    That does not really help the bug - it makes it worse. There are always needs to access form information in both Edit and View modes.

  • Verified answer
    DSFlemming Profile Picture
    DSFlemming 117 on at
    Re: Counting Attachments to enable a button

    Just spoke to microsoft support, the FormMode must be New in order to access values in the form. I was testing my progress in Edit mode. I didn't realise the different modes would have that effect. 

    Always learning! 

  • WarrenBelz Profile Picture
    WarrenBelz 145,580 on at
    Re: Counting Attachments to enable a button

    Hi @DSFlemming ,

    On the OnSelect of the button outside the gallery.

  • DSFlemming Profile Picture
    DSFlemming 117 on at
    Re: Counting Attachments to enable a button

    Interesting. Just created a new project just incase there was something quirky in my current app but no change. Tried a different user - no change. Just have to wait I guess.

    Where did you set the variable?

  • WarrenBelz Profile Picture
    WarrenBelz 145,580 on at
    Re: Counting Attachments to enable a button

    Hi @DSFlemming ,

    There is something else strange here - I have duplicated this error before as you see from the post, however I just did the below

    WarrenBelz_0-1641519062781.png

    WarrenBelz_1-1641519078082.png

     

  • DSFlemming Profile Picture
    DSFlemming 117 on at
    Re: Counting Attachments to enable a button

    For what it's worth, you can't access a variable from inside the form either. I tried to update a counter when adding an attachment and nothing happens. It just stays at its initialised value.

    DSFlemming_0-1641516285022.png

     

  • DSFlemming Profile Picture
    DSFlemming 117 on at
    Re: Counting Attachments to enable a button

    This is seriously irritating. Is there any way to add an attachment to a list without a form?

  • WarrenBelz Profile Picture
    WarrenBelz 145,580 on at
    Re: Counting Attachments to enable a button

    Hi @DSFlemming ,

    I think you are yet another victim of this bug

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard