Get a field in one list from a field and add

Copper Contributor

Hello friends, I'm new to powera automate.

I would like some help regarding a vacation logic, I have input several information, including collaborators, total days and etc.

I need to include in the "refused" condition, get the total number of days that the employee currently has (check the list) and add it to the total number of days and restore the employee's days.

Ex.
Total: 20
Requested: 5
Remaining: 15

But if denied, go back to 20.

1 Reply

Hi @oslecat , I would approach this in a slightly different way. I would have a list which contained the employee name, unique ID (likely the email address) and a column titled 'total_leave_allowance' to contain the annual allowed days.

 

Your second 'request' table would store all requests as they come in and would have a multi-select field titled 'approved_refused'.

 

When a request is submitted your Flow would get the annual allowance from the first list, then all approved (and likely pending) requests from the second list using the employee ID and status (approved/refused) as your filters in the query part of the Get items action.

Next your Flow would use an array to consolidate all matching items returned and sum the approved (and likely pending approval) requests. You can find a useful guide to using an array to sum values here: Instantly sum an array with Power Automate