I'm in the process of creating a holiday request tool in SharePoint 365.
I have created two lists thus far:
1. A list for employees for them to log their holiday request:
2. A list for admin/management:
NB. The 'Days Left' column is a calculated column based on 'Total Days - Days Used'.
A) I want to create an approval flow, in order for Management to approve the holiday request.
B) I want to add the 'Number of Days' from list 1, to the 'Days Used' in list 2 (there will only ever be one row per employee in this list).
I have the following built so far:
Unfortunately, this is where I get a little lost, IE what syntax I use to drag in the 'Number of Days' for the individual item and apply it to the right employee?
I tried the community search function but was unable to find the exact solution to my problem. The closest I came to an asnwer was this post.
Any help would be appreciated.
According to your description, I created two lists, List A and List B.
In list A, there are columns name and Number of days.
In list B, there are columns name, Total days, days used and Days left (type of calculated).
Then in the flow, use the trigger When an item is created. (you could also use when an item is created or modified). Here, use the List A.
Then action Initialize variable. Name set as Used, Type as Float, and Value as 0.
Then Start an approval action, if the Response is equal to Approved, sent an email to the creator. Then Get items from List B.
After Get items action, add Set variable action, name set as Used, select dynamic content Number of days from the trigger for the Value field.
Then the Increment variable, Name set as Used, select dynamic content Days used from the Get items action.
Finally, use the Update item action to update the days used to List B. And in the field Days used, enter the variable Used.
I have tested it on my side and it works fine.
Please have a try with it.
Many thanks, Mabel, your help and the speedy reply are very much appreciated.
Unfortunately, I have hit one small snag at the following stage:
'After Get items action, add Set variable action, name set as Used, select dynamic content Number of days from the trigger for the Value field.'
As I'm looking at list B, I do not have 'Number of Days' as a choice option. I've checked and double checked the preceding actions/content.
Am assuming I've missed something obvious.