cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kosenurm
Post Patron
Post Patron

Patch all gallery items on button click

Hi there,

 

I have a basic canvas app which only displays records from Dataverse in a Gallery when the Manager Name dataverse column record matches User().FullName.  This is working fine. 

 

What I want to happen is when the user has reviewed the records (they can't change anything), they click a button which patches all rows in that Gallery in the "Process Status" column I have created to "Completed"

 

I am trying this and getting no errors, but the Dataverse is not being patched. 

ForAll(Gallery1.AllItems, Patch('Attestations', {'Process Status': "Completed"}));

 

What am I doing wrong?

 

Thanks

K.

1 ACCEPTED SOLUTION

Accepted Solutions
shoog
Solution Specialist
Solution Specialist

You seem to be missing the second argument of the Patch function:

ForAll(Gallery1.AllItems, Patch('Attestations', ThisRecord, {'Process Status': "Completed"}));

View solution in original post

3 REPLIES 3
shoog
Solution Specialist
Solution Specialist

You seem to be missing the second argument of the Patch function:

ForAll(Gallery1.AllItems, Patch('Attestations', ThisRecord, {'Process Status': "Completed"}));

View solution in original post

gabibalaban
Super User
Super User

@Kosenurm ,

@shoog proposal works, but please have in mind that this approach will send multiple patch queries to Dataverse server and the app response time will be affected. 

Try this approach:

Patch
    ('Attestations',
    ForAll(Gallery1.AllItems,
            {
               Attestations:Attestations,
               'Process Status':"Completed"
            }
    )
)

where 'attestations' column is the unique identifier column of your table.

gabibalaban_0-1636990494919.png

This approach will send only one query to DataVerse server with all necesary data for update.

 

Hope it helps ! 

shoog
Solution Specialist
Solution Specialist

@gabibalabanThanks for the tip, this is indeed much faster, especially for large datasets.

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,356)