Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Patch records from collection into choice field with button click

(0) ShareShare
ReportReport
Posted on by 18

Hello,

I'm unable to find a solution for this specific example.

Goal: User selects one or more records from a gallery using checkboxes and is routed to a screen to perform different actions. One action is to simply click a button and the choice field for all associated records is set to "Returned".

 

Return Button:

Patch('Main Data',ForAll(Collect_List1,{Status: "Returned"}));
Clear(Collect_List1);
Back()

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at
    Re: Patch records from collection into choice field with button click

    ForAll(Collect_List1,

    Patch(

    'Main Data',

    Defaults('Main Data')

    ,{Status: {Value: {"Returned"}}

    )

    );
    Clear(Collect_List1);
    Back()

  • GAM1741 Profile Picture
    18 on at
    Re: Patch records from collection into choice field with button click

    I'm receiving error: The type of this 'Status' does not match the expected type 'Record'. Found type 'Text'.

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at
    Re: Patch records from collection into choice field with button click

    Nogueira1306_0-1668621203907.png

    ForAll(Collect_List1,

    Patch(

    'Main Data',

    Defaults('Main Data')

    ,{Status: "Returned"}

    )

    );
    Clear(Collect_List1);
    Back()

  • GAM1741 Profile Picture
    18 on at
    Re: Patch records from collection into choice field with button click

    Thanks for the response. I added the update function but still can't seem to make it work. I'm new to Power Apps and sure I'm missing something simple. 

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at
    Re: Patch records from collection into choice field with button click

    ForAll(Collect_List1,

    Patch(

    'Main Data',

     

    //YOU NEED TO INSERT HERE IT IS NEW OR UPADTE

     

    ,{Status: "Returned"}

    )

    );
    Clear(Collect_List1);
    Back()

     

     

    That formula should work for you. You just need to say if it is a new record if you are updating a record

     

    https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-patch

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,

    Gonçalo Nogueira

    Check my LinkedIn!

    My website!

    My blog!

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard