cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ShraddhaShah
Level: Powered On

Browse gallery not updated after adding or updating record in power apps in custom app

Hi,

 

I have create one custom Web Api. I have made a connection to this Api and created simple app for performing CRUD operation. I have done all the things and its working fine but I have one problem in refreshing the item in Browse Gallery after adding or updating the record. If I will search or change the sorting order then it wil display the newly added item or updated item. So how can I refresh the Item when I insert the item.

 

FYI - I have use Custom Web Api as data source.

 

Thank you.

7 REPLIES 7
Meneghino
Level 10

Re: Browse gallery not updated after adding or updating record in power apps in custom app

Hi, two quick thoughts:

  • after the additon or updating, do a Refresh of the datasource
  • OR, use a collection as the items of the gallery and ClearCollect after the addition or updating
Community Support Team
Community Support Team

Re: Browse gallery not updated after adding or updating record in power apps in custom app

Hi ShraddhaShah,

 

You could also use Refresh function to refresh the records of a data source. Add a button control in your App and set its Onselect property to Refresh(Data source).

 

Please see details in this article:
https://powerapps.microsoft.com/en-us/tutorials/function-refresh/

 

Hope this can be a reference for you.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Piia
Level: Powered On

Re: Browse gallery not updated after adding or updating record in power apps in custom app

I tried to use Refresh function to my Custom API datasource. Studio gives me an errormessage: "Only managed connections can be refreshed."

 

How can I refresh a Gallery that uses Custom API as datasource?

Community Support Team
Community Support Team

Re: Browse gallery not updated after adding or updating record in power apps in custom app

Hi Piia,

 

I have seen a similar issue about refreshing API data source. I assume it could be a reference for you: https://powerusers.microsoft.com/t5/PowerApps-Forum/API-DataSource-does-not-refresh-the-data/m-p/121...

 

Best regards, 

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Piia
Level: Powered On

Re: Browse gallery not updated after adding or updating record in power apps in custom app

Hi,

 

Thank you for your response. Link was helpful, but I didn't get the context variable to work with my gallery:

 

I have a form with buttons to guide the navigation to next form. In button OnSelect I have these actions:

UpdateContext({FetchedItems: MyAPI.GetAll(User().Email)}); Navigate(MyGallery, ScreenTransition.Fade)

This works fine, but I'm not able to bind FetchedItems to my gallery on MyGallery-form.

What am I missing here?

 

BR,

Piia

Highlighted
Piia
Level: Powered On

Re: Browse gallery not updated after adding or updating record in power apps in custom app

I solved that one using ClearCollect instead of UpdateContext. Now refresh works fine with CustomAPI as datasource.

Anonymous
Not applicable

Re: Browse gallery not updated after adding or updating record in power apps in custom app

Hi Piia,

 

This issue hapenned because when you UpdateContext a variable, you set a local variable of the screen. When you navigate out of that screen you go to another context.

 

In your case, you set the variable FetchedItems with 

UpdateContext({FetchedItems: MyAPI.GetAll(User().Email)})

 and then you navigate away to another screen

Navigate(MyGallery, ScreenTransition.Fade)

 then you change to another context, where FetchedItems wasn't set, veing a local variable.

 

What you did was to create a global collection of the App, with ClearCollect, and that makes sense if you're using that collection in multiple screens. If not, what you can do is passing the context through screens, like this:

Navigate(MyGallery, ScreenTransition.Fade, {FetchedItems: MyAPI.GetAll(User().Email)})

and replace this with the previous two instructions of code.

 

BR,

Luis

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,858)