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 / Refresh Gallery items ...
Power Apps
Unanswered

Refresh Gallery items with Office365users data source after a user update through a power automate flow

(0) ShareShare
ReportReport
Posted on by 71

Hi, I have a Gallery with an Office365users connection which is showing on an form the details for the user selected. If a filed is modified I have a Save button that runs a power automate flow with a steps that update the user data with a Microsoft Entra ID connection. Everything is working well but the user can't see the changes after modification unless quiting the whole app and entering again. 


I've tried to refresh the data source but it says that "Only managed connections can be refreshed". How could I do it?

 

Thanks a lot! 

 

Set(result, 'UPM|ModifyUser'.Run(Gallery1.Selected.Id, DisplayNameInput.Text));
If(result.response = "success", 
 (
 Notify("User modifyed.", NotificationType.Success) & Refresh(Gallery1.Selected)
 ),
 (Notify("Error occurred while trying to modify user.", NotificationType.Error))

);



Categories:
  • MudassarSZ365 Profile Picture
    591 on at

    Hi @mgisbert ,

    Recollect Data: After the Power Automate flow runs successfully, you can re-collect the user data into a collection which the gallery uses as its data source. This forces the app to fetch the latest details.

    ClearCollect(UserDetailsCollection, Office365Users.UserProfile(Gallery1.Selected.Id));

    Update Context: Use the UpdateContext function to update a variable that will trigger the gallery to refresh its data.

    UpdateContext({varLastRefresh: Now()});

    Create a button that, when clicked, fetches the updated user data for the selected user.

    Button.OnSelect = Collect(UserDetailsCollection, Office365Users.UserProfile(Gallery1.Selected.Id))

    Have the Power Automate flow return the updated user details, and use those details to update the collection that feeds the gallery.

    Set(result, 'UPM|ModifyUser'.Run(Gallery1.Selected.Id, DisplayNameInput.Text));
    If(result.response = "success", 
     (
     Notify("User modified.", NotificationType.Success);
     // Assume result.userDetails is the updated data returned by the flow
     UpdateIf(UserDetailsCollection, Id = Gallery1.Selected.Id, result.userDetails)
     ),
     Notify("Error occurred while trying to modify user.", NotificationType.Error)
    );

    If this answer helps you with your Power Apps issue, please consider accepting it. 😊

     

  • mgisbert Profile Picture
    71 on at

    Thanks @MudassarSZ365, I have tried to create a collection and get items for the gallery from the collection but it didn't work.

     

    Only the action you mentioned: 

    Collect(UserDetailsCollection, Office365Users.UserProfile(Gallery1.Selected.Id))

     

     is throwing this error: 

    Invalid argument type. Expecting one of the following: Text, Number, Decimal, Date, Time, DateTimeNoTimeZone, DateTime, Boolean, OptionSetValue, ViewValue, UntypedObject.

     

    So I guess I can't do it like that. I have a "Save" button and I wouldn't like to create any other Refresh button, I want to get again the items (or update the selected item) for the gallery when "Save" button is pressed. 

     

    Many thanks!

  • mgisbert Profile Picture
    71 on at

    Any other way to do the users import apart from Office365users connection which can be refreshed?

     

    Thanks

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