cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mmchx
Helper III
Helper III

Leave Request Template with sharepoint list

I just create the 2 sharepoint lists.

one for collecting all the leave requests ad one for the leave balance like this.

mmchx_0-1637140114227.png

But I have a problem that, It works only for one user.

I mean on my Leave request app, I want the users to see how many leave balances each type that they have left. like this.

mmchx_1-1637140302742.png

 but I don't know how to make it works for all users.

Example

User A

  • sick leave balance (maximum) = 10, Annual leave balance (maximum) = 20
  • already request the annual leave 4 days ->> current annual leave balance = 20 - 4 =16    

User B

  • sick leave balance (maximum) = 10, Annual leave balance (maximum) = 20
  • already request the sick leave 1days ->> current sick leave balance = 10-1 = 9

I don't know how can I make the sharepoint know that the current annual leave btw User A & User B is different , also how can I update the data for showing on the Power apps.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @mmchx ,

In your case, you have the user's name (the field would be better called NameUser), but disregarding this

LookUp(
   typeofleave,
   UserMail=User().FullName
).Current_AnnualLeave

would get the current annual leave.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

10 REPLIES 10
WarrenBelz
Super User
Super User

Hi @mmchx ,

You need the user's email in the List and then compare this with the built-in function User().Email

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

So I need to create the user's email column on the ListTypeofLeave and another column to store the leave days that user requests right? 

I'm sorry that I don't get how can I compare with the built-in function User().Email. 
since power apps don't store anything

@mmchx ,

I am assuming ListTypeofLeave is a List? If you had a field called UserMail storing the User's email and another field called LeaveDays, you would get the value of that field in the current user's record with 

LookUp(
   ListTypeofLeave,
   UserMail=User().Email
).LeaveDays

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

mmchx
Helper III
Helper III

Yes, ListTypeofLeave is a List. I see appreciate it!
like this right? then if I want to the number of the current balance, I just calculate in power apps and update the value via power automate.

mmchx_0-1637159282178.png

 

Hi @mmchx ,

In your case, you have the user's name (the field would be better called NameUser), but disregarding this

LookUp(
   typeofleave,
   UserMail=User().FullName
).Current_AnnualLeave

would get the current annual leave.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

mmchx
Helper III
Helper III

Got it Thank you very much, looks like on this part I need to manually create it without using the gallery lol. 

mmchx_0-1637199805163.png

 

@mmchx ,

Is this solved now - if so please mark as solution.

arr, I have a problem with the lookup 

based on your code, I set OnStart

set(currentUser,User().mail)

  the power apps stored the user's mail correctly without error.

but when I applied to the Label like this

LookUp(
   typeofleave,
   NameUser= CurrentUser
).Current_AnnualLeave

It has the error on the equal sign "Incompatible types for comparison. These types can't be compared: Record, Text."

Even I change the currentUser to Office365Users.MyProfileV2().mail

mmchx
Helper III
Helper III

Oh I got it, sorry for my dumb 😅

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,383)