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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Behavior function in a...
Power Apps
Answered

Behavior function in a non-behavior property for image control

(0) ShareShare
ReportReport
Posted on by 234

According to the docs a behavior function can only be used with an "On....." action like OnSelect,.

 

We are trying to store the user profile picture in a collection together with the ID of the user. This will allow us to search the collection and only query the Office365Users API when we don't have the image in the collection. Currently we have a Gallery and in that Gallery there's an "Image" control  We cannot use the behavior function "Collect" in the "Image " control/property. 

 

The "OnSelect" property of the "Image" is not used. How can we collect the image for each record/row in the Gallery and then use it in the "Image" property?

 

What we would like to use in the Image property but is currently failing:

 

If(
 Not(ThisItem.userOfficeID in varProfilePictures.id),
 Collect(
 varProfilePictures,
 {
 id: ThisItem.userOfficeID,
 picture: Office365Users.UserProfileV2(ThisItem.userOfficeID)
 }
 )
);
LookUp(varProfilePictures, id = ThisItem.userOfficeID)

 

 

What is the best way to achieve this? 

Categories:
  • Verified answer
    CU-18081211-6 Profile Picture
    9,272 Moderator on at

    Hi @DarkLiteOne ,
    You have to collect your photos in other place, like OnVisible property of the screen or OnSelect property of the control where you define the gallery's datasource. I’m not sure what is the source of your gallery. The formula should be:

     

     

    ForAll(
     Filter(yourGalleryDataSource,!(userOfficeID in varProfilePictures.id)),
     Collect(varProfilePictures,
     {id:userOfficeID,
     picture:Office365Users.UserPhotoV2(userOfficeID)}
     )

     

     

     

    Hope it helps !

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 394 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

Last 30 days Overall leaderboard