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 / Collect and Patch not ...
Power Apps
Answered

Collect and Patch not working anymore

(0) ShareShare
ReportReport
Posted on by 308

Hi all

 

I have an app to bulk update items (sharepoint list as data)

I have the formulas:

Gallery with checkbox items: Filter(PlanProjetos; Analise = "Aguardando Aprovação")

onCheck : Collect(colupdatesPlan;ThisItem)

onUnCheck: Remove(colupdatePlan;thisitem)

Save button: 

UpdateIf(colUpdatesPlan;true;{Analise: "Aprovado";Aprovador: User().Email});;

Patch(PlanProjetos;colUpdatesPlan);;

 

It worked fine but now is showing error and don't save updates. The error is "the specified column is read-only and can't be modified"

 

What I need to change? How to collect only certain columns with "Thisitem"? and Remove if necessary?

 

Thanks

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @alessandramaced 

    Why bother collecting and duplicating the data?  You already have what you need in the Gallery.

    Your formula should be based on the Checkbox filter and it would look like this:

    Patch(PlanProjetos;
     ForAll(Filter(yourGallery.AllItems; yourCheckbox.Value);
     {ID: ID;
     Analise: "Aprovado";
     Aprovador: User().Email
     }
     )
    )

    No collections needed!  Nor OnSelect actions of checkboxes.

     

    The above formula also assumes that your Aprovador column is a text column.

     

    I hope this is helpful for you.

  • alessandramaced Profile Picture
    308 on at

    Hi

     

    Put this :

     

    Patch(PlanProjetos;
    ForAll(Filter(galPlanos.AllItems; Checkbox1_2.Value = true);
    {IDProj: IDProj;
    Analise: "Aprovado";
    Aprovador: User().Email
    }
    )

     

    but instead of change the record, its creating a new one with IDPRoj, "Aprovador" and "Analise"

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @alessandramaced 

    This is because you changed the primary key!  It was ID and should be ID (assuming this is a SharePoint list).

    Formula should be:

    Patch(PlanProjetos;
     ForAll(Filter(galPlanos.AllItems; Checkbox1_2.Value);
     {ID: ID;
     Analise: "Aprovado";
     Aprovador: User().Email
     }
     )
    )

    If you omit the primary key (ID), then patch will create a new record.

    Also, no need to check if a value is true or false that is already a true or false value (Checkbox1_2.Value)

     

    Again, the ID is the primary key for a SharePoint list, so if you are using another datasource, then let me know.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard