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 / Setting Default proper...
Power Apps
Answered

Setting Default property to First(ThisItem.Attachments) on Attachments Datacard Breaks Entire App

(0) ShareShare
ReportReport
Posted on by 22

Hello, 

 

I just noticed a strange behaviour on my app. I have a requirement of picking only the latest attachment on my sharepoint list item in case an item has multiple attachments. This can only be achieved on powerapps form by changing the Default property of the attachments datacard from ThisItem.Attachments  to First(ThisItem.Attachments). 

Unfortunately every time i do this and save my page, next time i try to access my app, i find it broken. All my screens turn blank  when i try to edit the app as seen on the image below and also the entire app stops running when i publish it. The problem gets fixed when i revert the Default property back to ThisItem.Attachments. 

Has anyone else faced the same issue? Could this be a bug that needs to be fixed? I really need to be able to pick only the first attachment. Kindly help.

 

 

Blank.PNG

 

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    Hi @Saya ,

    I doubt the designers of this control had this in mind, so it appears that this code does not perform the required function.

    You can still use the code First(ThisItem.Attachments) to access the file and as another idea, put a custom card on the form with an image control and a label. The Image control Image is

    First(ThisItem.Attachments).Value

    and the Label Text

    First(ThisItem.Attachments).DisplayName

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • Saya Profile Picture
    22 on at

    Hello @WarrenBelz ,

     

    Thank you for your response. Unfortunately the Image control doesn't work. I honestly don't understand why the designer couldn't cater for something important like loading only the first or last attachment in the attachment data card section. I am completely stuck.

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    Hi @Saya ,

    Image control needs to be in a custom card (as with the label), not in the attachments card.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Saya Profile Picture
    22 on at

    Thank you @WarrenBelz  for the custom card idea. The Image solution finally worked. Since i am working with all sorts of attachments including audios and videos, i decided to approach it a little bit different. I used the label Text property for the attachment name First(ThisItem.Attachments).DisplayName and the attachment icon onSelect property for launching the attachment; 

     Launch(First(ThisItem.Attachments).AbsoluteUri)

    video.PNG

     

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    Thanks @Saya ,

    I tend to gravitate to the .Value method as this also works on mobile devices (which will not resolve a SharePoint URL in an image control) as my users are mainly mobile. I am glad you have a working solution.

     

    Please consider Accept as Solution as this closes the item and also allows others with similar issues to find it more easily.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard