0

How I can create simple database for example vacation request in SP list? It will looks like that: I create probably two list. In first list is vacation days people and on the second list is vacation request and when I add new vacation request I will see how many vacation days I have and when I take new day, this day subtract from my vacation days in first list and update this list and next time will be the same...

I have SP Foundation and Designer 2010.

Thanks for help,

2 Answers 2

1

You are on the right tracks with two lists and a parent-child relationship.

The tricky part is to keep track of the number of days left. You could have a workflow update the count, but what if the request later gets deleted? Workflows don't run on deleted items, so you're stuck. A workaround is to disable item deletion, and have a choice field for Requested/Approved/Cancelled.

Without workflows, the easiest way is to create a grouped view (by people and year) of your vacation requests and display the totals. Then you could compare these totals with the number of vacation days allowed (first list).

3
  • I was afraid that this solution will by difficult to do it without code :/ Can you help me to create this workflow, how it will looks like? Very thanks for your support
    – Wilon
    Aug 30, 2012 at 19:29
  • I am afraid there's not enough room in a forum post for all the details - especially as you might have specific rules (for example: do you count the vacation when it's requested? When it's approved?). A key point is that your second list will need two status fields: current status and previous status. Your workflow will need those two fields to check if the status has changed.
    – Christophe
    Aug 30, 2012 at 19:51
  • It's true... Once more thanks for your help, Best regards
    – Wilon
    Aug 30, 2012 at 20:15
2

That's not something which is simple in SharePoint

Without code your only option is to create a workflow on the second list which on create/update of items find the corresponding entry in the first list and updates the dates left. But it'll not add them back again if the entry is deleted.

If you extend your arsenal to include code, then you have the possiblity of adding an event receiver which can catch additions/updates/deletes. To play it safe you might also want to add a timerjob to periodically make sure everything is in sync.

If your environment don't allow server side code (even sandboxed) you might be able to have some code running on another maching periodically which made sure everything was in sync using Client Side code, but you may of cause just replace this with human intervention.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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