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 / Timesheet app error
Power Apps
Unanswered

Timesheet app error

(0) ShareShare
ReportReport
Posted on by 318

Hi all,

 

I am working on a time sheet app, i am having errors on approve and reject button, on approve button i have this error.

VikasNagaraj_0-1639144496252.png

Here is the code on approve button.

ForAll(
galleryTimeCard_2.AllItems,
If(IsBlank(ID),
Patch(
TimeEntries,
Defaults(TimeEntries),
{
Title: Text(First(selectedTimeCard.week).'Week Start',DateTimeFormat.ShortDate) & " - " & Text(First(selectedTimeCard.week).'Week Start' + 6, DateTimeFormat.ShortDate),
'Week Start':First(selectedTimeCard.week).'Week Start',
Mon: Value(tbMon_1.Text),
Tues: Value(tbTues_1.Text),
Weds: Value(tbWed_1.Text),
Thurs: Value(tbThurs_1.Text),
Fri: Value(tbFri_1.Text),
Sat: Value(tbSat_1.Text),
Sun: Value(tbSun_1.Text),
Total:Value(tbMon_1.Text) + Value(tbTues_1.Text) + Value(tbWed_1.Text) +
Value(tbThurs_1.Text) + Value(tbFri_1.Text) + Value(tbSat_1.Text) +Value(tbSun_1.Text),
Projects:tbProjects_1.Text,
Jobs:tbJobs_2.Text,
Projects: {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: ComboBox7.Selected.ID,
Value: ComboBox7.Selected.Title
},
Jobs: {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: ComboBox8.Selected.ID,
Value: ComboBox8.Selected.Title
},
Employee: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & currentUser.Email,
Department: "",
DisplayName: currentUser.FullName,
Email: currentUser.Email,
JobTitle: "",
Picture: ""
},
BillTo: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: cbBillTo_1.Selected.ID,
Value: cbBillTo_1.Selected.Title
},
Manager: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Office365Users.ManagerV2(User().Email).mail,
Department: "",
DisplayName: "",
Email: Office365Users.ManagerV2(User().Email).mail,
JobTitle: "",
Picture: ""
},
Status:{ID:2,Value:"Submitted for Approval"}
}
),
Patch(
TimeEntries,
{ID:ID},
{
Title: Text(First(selectedTimeCard.week).'Week Start',DateTimeFormat.ShortDate) & " - " & Text(First(selectedTimeCard.week).'Week Start' + 6, DateTimeFormat.ShortDate),
'Week Start':First(selectedTimeCard.week).'Week Start',
Mon: Value(tbMon_1.Text),
Tues: Value(tbTues_1.Text),
Weds: Value(tbWed_1.Text),
Thurs: Value(tbThurs_1.Text),
Fri: Value(tbFri_1.Text),
Sat: Value(tbSat_1.Text),
Sun: Value(tbSun_1.Text),
Total:Value(tbMon_1.Text) + Value(tbTues_1.Text) + Value(tbWed_1.Text) +
Value(tbThurs_1.Text) + Value(tbFri_1.Text) + Value(tbSat_1.Text) +Value(tbSun_1.Text),
Projects:tbProjects_1.Text,
Jobs:tbJobs_2.Text,
Projects: {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: ComboBox7.Selected.ID,
Value: ComboBox7.Selected.Title
},
Jobs: {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: ComboBox8.Selected.ID,
Value: ComboBox8.Selected.Title
},
Employee: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & currentUser.Email,
Department: "",
DisplayName: currentUser.FullName,
Email: currentUser.Email,
JobTitle: "",
Picture: ""
},
BillTo: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: cbBillTo_1.Selected.ID,
Value: cbBillTo_1.Selected.Title
},
Manager: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Office365Users.ManagerV2(User().Email).mail,
Department: "",
DisplayName: "",
Email: Office365Users.ManagerV2(User().Email).mail,
JobTitle: "",
Picture: ""
},
Status:{ID:2,Value:"Approved"}
}
)
));Set(
successMessage,
"Timesheet Approved"
);Navigate(Success)

 

On reject button i have this error.

VikasNagaraj_1-1639144582319.png

Here is the code on Reject button.

ForAll(
galleryTimeCard_2.AllItems,
If(IsBlank(ID),
Patch(
TimeEntries,
Defaults(TimeEntries),
{
Title: Text(First(selectedTimeCard.week).Week_x0020_Start,DateTimeFormat.ShortDate) & " - " & Text(First(selectedTimeCard.week).Week_x0020_Start + 6, DateTimeFormat.ShortDate),
Week_x0020_Start:First(selectedTimeCard.week).Week_x0020_Start,
Mon: Value(tbMon_1.Text),
Tues: Value(tbTues_1.Text),
Weds: Value(tbWed_1.Text),
Thurs: Value(tbThurs_1.Text),
Fri: Value(tbFri_1.Text),
Sat: Value(tbSat_1.Text),
Sun: Value(tbSun_1.Text),
Total:Value(tbMon_1.Text) + Value(tbTues_1.Text) + Value(tbWed_1.Text) +
Value(tbThurs_1.Text) + Value(tbFri_1.Text) + Value(tbSat_1.Text) +Value(tbSun_1.Text),
Projects:tbProjects_1.Text,
Jobs:tbJobs_2.Text,
Employee: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & currentUser.Email,
Department: "",
DisplayName: currentUser.FullName,
Email: currentUser.Email,
JobTitle: "",
Picture: ""
},
BillTo: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: cbBillTo_1.Selected.ID,
Value: cbBillTo_1.Selected.Title
},
Manager: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & currentUser.Email,
Department: "",
DisplayName: currentUser.FullName,
Email: currentUser.Email,
JobTitle: "",
Picture: ""
},
Status:{ID:2,Value:"Submitted for Approval"}
}
),
Patch(
TimeEntries,
{ID:ID},
{
Title: Text(First(selectedTimeCard.week).Week_x0020_Start,DateTimeFormat.ShortDate) & " - " & Text(First(selectedTimeCard.week).Week_x0020_Start + 6, DateTimeFormat.ShortDate),
Week_x0020_Start:First(selectedTimeCard.week).Week_x0020_Start,
Mon: Value(tbMon_1.Text),
Tues: Value(tbTues_1.Text),
Weds: Value(tbWed_1.Text),
Thurs: Value(tbThurs_1.Text),
Fri: Value(tbFri_1.Text),
Sat: Value(tbSat_1.Text),
Sun: Value(tbSun_1.Text),
Total:Value(tbMon_1.Text) + Value(tbTues_1.Text) + Value(tbWed_1.Text) +
Value(tbThurs_1.Text) + Value(tbFri_1.Text) + Value(tbSat_1.Text) +Value(tbSun_1.Text),
Projects:tbProjects_1.Text,
Jobs:tbJobs_2.Text,
Employee: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & currentUser.Email,
Department: "",
DisplayName: currentUser.FullName,
Email: currentUser.Email,
JobTitle: "",
Picture: ""
},
BillTo: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: cbBillTo_1.Selected.ID,
Value: cbBillTo_1.Selected.Title
},
Manager: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & currentUser.Email,
Department: "",
DisplayName: currentUser.FullName,
Email: currentUser.Email,
JobTitle: "",
Picture: ""
},
Status:{ID:2,Value:"Rejected"}
}
)
));Set(
successMessage,
"Timesheet Rejected"
);Navigate(Success)

 

I tried everything, i dont know where the problem is, please help. 

Categories:
I have the same question (0)
  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @VikasNagaraj 

     

    The error occurs in the column Jobs and I see you have text and Lookup.

     

    StalinPonnusamy_0-1639146425836.png

     

    You need to remove one of them based on the "Jobs" Column data type. What is the Data type for the column "Jobs"?

     


    Thanks,
    Stalin - Learn To Illuminate

  • VikasNagaraj Profile Picture
    318 on at

    @StalinPonnusamy 

    It is a sharepoint list with list of jobs as singleline text, I have used a combobox so that users can select the type of job they are doing.

    VikasNagaraj_0-1639146916703.pngVikasNagaraj_1-1639146940939.png

    Is this what you mean, please correct me if i am wrong.

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Ok, Jobs is a lookup then remove the first highlighted one.

     

    Remove this line --> Jobs:tbjobs_2.text

  • VikasNagaraj Profile Picture
    318 on at

    @StalinPonnusamy 

    Thank you very much, it fixed my issue. You are awesome.

    One more thing The date format here is in US, I want to change it to UK format, dd/mm/yyyy can you help me please.

    VikasNagaraj_0-1639149291797.png

    Datepicker Items:

    AddColumns(
    weeksList,
    "WeekEnd",
    DateAdd(
    Value,
    6,
    Days
    ),
    "Week Display",
    Value & " to " & DateAdd(
    Value,
    6,
    Days
    )
    )

    Onstart App is:

    Concurrent(
    Set(
    currentUser,
    User()
    ),
    Set(
    currentMonday,
    DateAdd(
    Today(),
    -1 * (Weekday(
    Today(),
    Monday
    ) - 1),
    Days
    )
    ),
    Set(
    weeksList,
    ForAll(
    Sequence(
    20,
    Day(
    DateAdd(
    Today(),
    -1 * (Weekday(
    Today(),
    Monday
    ) - 1),
    Days
    )
    ) - 28,
    7
    ),
    Date(
    Year(Today()),
    Month(Today()),
    Value
    )
    )
    )
    );

    Should i change anything here?

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 762

#2
11manish Profile Picture

11manish 640

#3
Valantis Profile Picture

Valantis 548

Last 30 days Overall leaderboard