cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dhinesh28R
Post Prodigy
Post Prodigy

Refresh Collection after patch

Hi,

In my Gallery i gave a Collection for Items.

I edit an Item From that Gallery selected.

After patch i cant refresh a Collection.

 

How to update a Collection after Update an item?

 

Thanks,

Dhinesh

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User
Dual Super User

I assume you are patching the original data source.  If you are then there are only two options.

1) Apply the same Patch/Update to the collection that you are applying to the data source.

2) Re-run whatever code you ran to create the collection to begin with.  Make sure to use a Clear() or ClearCollect as the first statement or you'll get duplicates.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
Pstork1
Dual Super User
Dual Super User

I assume you are patching the original data source.  If you are then there are only two options.

1) Apply the same Patch/Update to the collection that you are applying to the data source.

2) Re-run whatever code you ran to create the collection to begin with.  Make sure to use a Clear() or ClearCollect as the first statement or you'll get duplicates.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @Pstork1,

Yes , still am updating a DataSource. Now am updating a collection. Working fine.

 

Thanks,

Dhinesh

daruom
Helper II
Helper II

Hello,

Whenever possible, I recommend using a form in "Edit" mode to update the source.

In the "OnSuccess" property, you can put the following formula:

Collect(MyCollection, MyForm.LastSubmit)

 

It will just add the new record to the collection after updating the source.

chasetran
Microsoft
Microsoft

I had the same problem, here's how I solved it:

 

Considering my gallery is based on Collection, my form is based on Item=Lookup(datasource). When I submit the form, I do

// update data source record
SubmitForm(Form);

// update collection record; best to do this OnSuccess of the Form
Patch(Collection, Gallery.Selected, { field1: Form.LastSubmit.field1, field2: Form.LastSubmit.field2});

 

Note that I specified the fields to updates. 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,906)