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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Error when build...
Power Apps
Unanswered

Patch Error when building power app

(0) ShareShare
ReportReport
Posted on by

Hi All,

 

I am following a Udemy course on building a timesheet using collections. I ran into an error that other students ran into and it hasnt been resolved:
This is the collection which is in the OnVisible property of the page:

 

Reset(cmbApprover); Reset('selected Week');
ClearCollect(colTimesheetDetails,First('Timesheet Details')); Clear(colTimesheetDetails);

ForAll([6,5,4,3,2,1,0],
Collect(colTimesheetDetails,
{
'Employee Email' : varUser.Email,
'Week End' : DateValue(lblWeekEnd.Text),
WeekEndNum : Text(DateValue(lblWeekEnd.Text),"yyyymmdd"),
'Day of Week' : DateValue(lblWeekEnd.Text)-Value,
DayofWeekNum : Text(DateValue(lblWeekEnd.Text)-Value,"yyyymmdd"),
'Day Start' : {value: "8:30 am"},
'Lunch Start' : {value: "12:00 pm"},
'Lunch Finish' : {value: "1:00 pm"},
'Day End' : {value: "5:00 pm"},
'Break Hours' : 0,
'Paid Hours' : 7.5,
'Approval Status' : {value : "In Progress"},
'Overtime Hours' : 0,
'Work Day' : {value : "Work Day"}

}
))

 

This is the patch formula giving an error:

Patch(colTimesheetDetails,ThisItem,{'Day Start': ddDayStart.Selected.Value})

The errors and sharepoint list setting can be found in the attached images.

 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @Palendren10 ,

     

    Since 'Day Start' is a Choice type column, it wants a record, but by selecting the Value, the reference to ddDayStart returns a text.

     

    Assuming that the Items property of ddDayStart is Choices('Timesheet Details', 'Day Start'), the below should resolve the error:

     

     

    Patch(colTimesheetDetails,ThisItem,{'Day Start': ddDayStart.Selected})

     

     

  • iAm_ManCat Profile Picture
    18,228 Most Valuable Professional on at

    Hey, I think that needs to be wrapped into a record like you have it in your first patch, so it will be like this:

     

    Patch(colTimesheetDetails, ThisItem, {'Day Start': {value: ddDayStart.Selected.Value} } )
  • Adrià Profile Picture
    69 on at

    Day Start is a complex field You have to use patch like this:

     

    Patch(colTimesheetDetails,ThisItem,{'Day Start':{

    '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",

    Id: The corresponding id

    Value:ddDayStart.Selected.Value})

    }

     
  • Palendren10 Profile Picture
    on at

    The Items property of ddDayStart is a variable call varTimes which is set OnStart of the app. 
    Set(varTimes,["6:00 am","6:15 am","6:30 am","6:45 am"])

    I am not sure if this helps with a solution?

  • Palendren10 Profile Picture
    on at

    Hey, i tested this out and it introduced 1 new error. For context (please let me know if i should provide any specific information):

    The Items property of ddDayStart is a variable call varTimes which is set OnStart of the app. 
    Set(varTimes,["6:00 am","6:15 am","6:30 am","6:45 am"])

    I am not sure if this helps with a solution?

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @Palendren10 ,

     

    It does make a difference indeed. The way to deal with this was already posted above by @iAm_ManCat where the selected value is converted to a record.

  • Palendren10 Profile Picture
    on at

    Hi @BCBuizer , @iAm_ManCat , the image attached shows the new error when i used the proposed solution.

  • Palendren10 Profile Picture
    on at

    The record error changed to the attached image, saying i need a record from a different Schema.

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @Palendren10 ,

     

    I see there was a small typo in @iAm_ManCat 's formula. Please try:

     

    Patch(colTimesheetDetails, ThisItem, {'Day Start': {Value: ddDayStart.Selected.Value} } )
  • Palendren10 Profile Picture
    on at

    Still getting the same error @BCBuizer . Should i potentially check any other properties?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard