1

I am trying to create an annual leave calendar. I have it set up so each annual leave for an employee is an event (so if I take off on 23 March, that is one day of annual leave). Is there a way to designate a set number of annual leave days for an employee (41 days per year) and then have SharePoint calculate the remaining number of annual leave days the person is entitled to after adding in a new event (my 41 days per year becomes a remaining 40 days per year)?

  • check out calculated fields. You can use a formula to subtract 'number of days holiday used' from the 'Total Days Annual Leave' field. – Tally May 3 '18 at 10:28
  • 1
    A Calculated field will only work on the list element you are on. You would need a workflow here, since the leave would most likely be stored in another list. Also a workflow is nice since leave needs to be approved also – Heiko Hatzfeld_MSFT May 3 '18 at 10:58
  • Which version of SharePoint? If SP2013 or later, 2013 style workflows can make REST web service calls to read data from other rows. – Mike Smith - MCT - MVP May 4 '18 at 2:48
0

SharePoint is not the best place for these types of projects, but here's a possible solution if you are using SP2013 or later and your farm has everything installed to support 2013 style workflows.

Keep in mind:

  • A list is needed with the total number of days allowed for each employee (assuming they don't all get 41 days per year (Really, 41? What kind of job is this? :-) )).
  • Any row could be updated at any time, so the workflow must check and update every row in the current year for that employee.
  • Two "advanced" workflow features are used: Looping and REST API calls.

Workflow steps:

  • Workflow is triggered by the edit of any one item.
  • Workflow reads the column with the employee's ID and uses the REST API to read the number of leave days from another list with at least an employee ID and max leave days.
  • Workflow uses the REST API to read a date ordered list of all rows for the current year of the current item's employee.
  • Workflow loops through all rows calculating the remaining days and updating each row as needed.
  • ??? Workflow sends an email to someone if more than max leave days requested.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.