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 / Can no longer Patch a ...
Power Apps
Unanswered

Can no longer Patch a simple collection?

(0) ShareShare
ReportReport
Posted on by 112

Can someone tell me why the below collection will not submit?

 

The issue is specifically with the column Five portion of the collection as it was submitting before I added this.

 

The patch code has the red X beside the submit button, but it isn’t clear why it’s wrong. If I view the collection I can see the date stored there just fine.

 

Collection code:

 

Collect(Col1, {One: Country_1.Selected.Value, Two: Text(DateOut_1.SelectedDate,"dd/mm/yyyy"), Three: Text(DateBack_1.SelectedDate,"dd/mm/yyyy"), Four: Reason_1.Selected.Value, Five: Text(Today(),"dd/mm/yyyy")})

 

Submit button OnSelect code:

 

Patch('Travel Notification', ForAll(Col1 As _Data,{Destination: _Data.One, Date_Departure: _Data.Two, Date_Return: _Data.Three, Reason: _Data.Four, Date_Created: _Data.Five}));

Categories:
  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @elfreddos ,

     

    Do you mean that Patch function doesn't work?

    Could you please tell me the type of Date_Created column and database?

    Or you can try this first:

    ForAll(Col1 As _Data,Patch('Travel Notification',Defaults('Travel Notification'),{Destination: _Data.One, Date_Departure: _Data.Two, Date_Return: _Data.Three, Reason: _Data.Four, Date_Created: _Data.Five}));

     

     

    Best regards,

    Rimmon

  • elfreddos Profile Picture
    112 on at

    Thanks for that! The column is a date/time column in SharePoint but with Date Only display.

     

    Unfortunately, that code you sent over also doesn't work. It throws up a red line from the "patch" portion.

  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Could you please show me error details?

     

  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @elfreddos 

     

    for collection try:

    Collect(Col1, {One: Country_1.Selected.Value, Two: Text(DateOut_1.SelectedDate,"dd/mm/yyyy"), Three: Text(DateBack_1.SelectedDate,"dd/mm/yyyy"), Four: Reason_1.Selected.Value, Five: Text(Today(),"dd/mm/yyyy")})

     

    patch:

    Patch('Travel Notification', ForAll(Col1 As _Data,{Destination: _Data.One, Date_Departure: _Data.Two, Date_Return: _Data.Three, Reason: _Data.Four, Date_Created: _Data.Five}));

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • timl Profile Picture
    37,287 Super User 2026 Season 2 on at

    Hi @elfreddos 

    Assuming that the data types of Date_Departure and Date_Return are dates, you would need to call DateValue to convert the Text dates to Date objects:

    Patch('Travel Notification', 
     ForAll(Col1 As _Data,{Destination: _Data.One, Date_Departure: DateValue(_Data.Two), Date_Return: DateValue(_Data.Three), Reason: _Data.Four, Date_Created: DateValue(_Data.Five)})
    );

     

    As I mentioned in your other post, saving DatePicker.SelectedDate to a collection saves a Date object to the collection. I would recommend that you stick with this approach. If you're seeing US dates in the collection view, the probable reason for this is that your browser is set to US English.

     

    If you build the collection like so, the Patch should hopefully work.

     

    Collect(Col1, {One: Country_1.Selected.Value, Two: DateOut_1.SelectedDate,
     Three: DateBack_1.SelectedDate, Four: Reason_1.Selected.Value, 
    Five: Today()})
    Patch('Travel Notification', ForAll(Col1 As _Data,{Destination: _Data.One, Date_Departure: _Data.Two, Date_Return: _Data.Three, Reason: _Data.Four, Date_Created: _Data.Five}));

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard