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 / Bug? Gallery Component...
Power Apps
Unanswered

Bug? Gallery Component + Office 365 Users data source

(0) ShareShare
ReportReport
Posted on by 6

Hello,

 

I'm experiencing a weird behavior while using component with Office 365 Users data source.

I prefer to tell you first that I'm using the French version, I tried to adapt pieces of code in English but there may be small differences (who came up with this amazing idea to 'translate' the formula syntax for French users?  It's not even developer-friendly! 🤔)

 

Let me describe it:

 

I'm making a component with a gallery inside. There is a table input parameter, let's call it 'tab'. Each element can represent an employee or an entity like a team. The useful fields for what I'm trying to do are 'email', 'type' (either 'Person' or 'Group') and some identifier field (like 'id').

Inside this component there is a gallery. The model contains a label with a Text property : If(ThisItem.type = "Person", First('Office365Users'.SearchUser({searchTerm: ThisItem.email})).DisplayName). It means that if this item is type Person then show his display name (from 'email' field) on the label.

In order to use it in my app, 'tab' takes a Table global variable 'myTab' which has the same schema.

In the first place, 'myTab' is initialized using ClearCollect with blank value for email fields and is updated using Patch function to fill this field.

 

For example, I have 2 Person and the third element is a Group. So the label representing the group should be blank.

Instead, this label contains the display name of the first person. When I edit the 'tab' default value on the component itself, it's fixed but it comes back when I reopen the app. Even though I enable 'Trigger OnReset when the value changes', it doesn't change anything.

 

So I tried in a small app and I was able to reproduce it. I have compared it with a single gallery, and this one has the right behavior.

 

image.png

Please find enclosed the .msapp file with the scenario I have described to you. For privacy issues, I have removed the original emails so you will have to edit them (in tab input parameter for Component1 and Component1_1, and in OnSelect property of Button1_1 (update)).

 

Thanks in advance.

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @spoonhermit 

    I took your app and added person and group emails to the table as you described.

    I did not see any issues.  Saved, exited, loaded, tried - no problems.

    RandyHayes_0-1611159084535.png

    Not that it impacts what you are seeing, but I would recommend the following on the label in your component gallery instead:

    If(ThisItem.type = "Person", 'Office365Users'.UserProfileV2(ThisItem.email).displayName)

     

     

  • spoonhermit Profile Picture
    6 on at

    (see my reply to RandyHayes' answer)

  • spoonhermit Profile Picture
    6 on at

    Thanks for your fast reply.
    When you add the new mails on the components tab input parameters, do you check if tab in app is updated too (when you update component default input parameters, it also updates the value of corresponding input parameters in app to the default one so you need to put myTab variable back) ?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @spoonhermit 

    I'm not seeing that in this case, but I have seen that before many times.  Your tab property should only have a sample signature that you shouldn't really change from that point forward.  If you do, you definitely run the risk of the component setting to its new defaults in all the instances you have on your screens.

  • spoonhermit Profile Picture
    6 on at

    Thank you for your feedback. 

     

    I asked my colleague if he had the same issue and it was the case.

    So I'd debugged the app using the monitor. We saw after patching the table that UserProfileV2 is called 3 times instead of 2 (as the table variable has 3 values: Person, Person, Group), even though a If statement is used. The function threw an error because the parameter is empty (Group has no email specified).

    The single gallery called 2 times the function, so the condition is respected in this case.

     

    It seems that this If is ignored, maybe during the compilation UserProfileV2 has a higher priority than this statement when it is used in a component.

     

    I will open a support ticket soon.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @spoonhermit 

    I'm not seeing it!  I have duplicated those steps but all seems fine.  I have 2 users and one group in my sample.  The monitor shows 2 UserProfileV2 functions being executed.

    What could be different??

     

    By the way, PowerApps are not compiled, they are interpreted. They are just like Excel in the way they perform the actions in the app.  So, compilation issues is not a point. 

     

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard