cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

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
Highlighted
Community Champion
Community Champion

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
Highlighted
Community Support
Community Support

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.
Highlighted

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?

Highlighted

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.
Highlighted

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
Frequent Visitor

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

Highlighted
Anonymous
Not applicable

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,829)