none
SHAREPOINT leave balance RRS feed

  • Question

  • hello please I need help

    I have been trying to calculate a leave balance from start date and end date column and I want the leave balance to be connected to every user on the sharepoint

    scenario

    if user ABC take a 3 days leave out of 30days maximum leave the remaining days is 27 

    if the same user ABC take another 5days it should be remove from the remaining 27 which make it remain 22

    also if public holidays is among the days taking the leave should able to jump that holiday days 

    thanks in advance


    Friday, August 16, 2019 4:22 PM

All replies

  • Which version of SharePoint are you using?

    1. If you are using on-premise then you can achieve this using 3 lists and a workflow (oob and recommended) or using custom scripting.

    2. If you are using SharePoint Online, then you can achieve this by modifying list form using powerapps or you can create a flow similar to the workflow.

    Create 3 lists.

    1. Public Holidays (Title, Date)

    2. Leave Balance (Person, LeaveBalanceCount)

    3. Leave Calendar (Title, Start Date, End Date, Reason)

    Steps of Workflow or flow:

    1. Start on Item creation

    2. Declare variables HolidayCount and dayCount = end date - start date

    3. Loop from 0 to dayCount and check if ever date is present in public holidays list

    4. If not then increment HolidayCount by 1

    5. Once loop completed, HolidayCount is the count of days without public holidays

    6. Update the applied users LeaveBalanceCount in Leave Balance list by subtracting HolidayCount from existing value.

    7. Any other logic of yours

    8. Completion of workflow

    Please mark as answer if you got your outcome.

    Thanks


    Sunday, August 18, 2019 6:20 PM