web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Model driven command b...
Power Apps
Answered

Model driven command bar - update all records selected

(1) ShareShare
ReportReport
Posted on by

Hi everyone,

 

I have a subrid with records. I want to select records, and press a button so the records are updated.

This is my code:

 

Patch('Training Subscriptions';
ForAll(Self.Selected.AllItems;
{
TriggerFlowResult:true;
Result:true}
))
 
But when I press my button, my records are duplicated instead of updated.
I tried lot of things, but nothing worked, ie : open & refresh component library, inverse Patch & ForAll places...
 
Any ideas?
Categories:
I have the same question (0)
  • SBax Profile Picture
    1,348 on at

    You don't need the for all, as self.selected.items is a collection

     

    Try

     

    Patch('

    Training Subscriptions',

    Self.Selected.AllItems,

    {

    TriggerFlowResult:true;

    Result:true

    }

    )

  • ProFe Profile Picture
    on at

    Thank you for your answer, but when I try this I encounter an error

    Capture d'écran 2023-12-08 085147.png

    This is due to .AllItems, I tried Self.Selected.Item but in this case I only patch the first selected record.

  • Verified answer
    Jonathan Manrique Profile Picture
    2,695 on at

    Hi @ProFe 

     

    The issue is that you are telling it to make a patch of elements and if you don't tell it which one the default one is creating,

    The first thing you should do is go through each element to make the patch and you can do this using the lookup function and that way you will be telling it that that element is going to be updated.

    If memory serves it would be Patch(tables,ForAll(elements;lookup,{
    TriggerFlowResult:true;
    Result:true}
    ))

    If not the other way around first ForAll(Patch(Lookup

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    You can accept more than one post as a solution

  • ProFe Profile Picture
    on at

    Great, I get it now.

    I managed to make it work with this formula :

     

    Patch('Training Subscriptions';ForAll(Self.Selected.AllItems;
    {
    'Training Subscription': ThisRecord.'Training Subscription'; // this line was missing
    TriggerFlowResult:true;
    Result:true
    }
    ))
     
    Thank you all for your help !

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard