I have a list with an employees holiday allocation and another list where they request holidays. I have an approval workflow triggered on the second list and I'd like to take the number of days the employee is allocated and subtract the days they've requested (if approved) and tell them how many days they have.
The Flow as stands is below. What I tried to do was to put the allocation value in a Compose action, the days requested in another Xompose action, then use a third with this expression to do the maths:
As soon as wrote the first Compose action Flow put it in a Apply to Each loop which I didn't think would be a problem and that's where I put the rest of the Compose actions. However it threw and error and wouldn't allow me to save the changes.
Where am I going wrong? All help appreciated.
1. For Second list, Use compose and take sum of all allocated leaves[approved]. you can use variable here so that all leaves store in a variable.(do not forget to use Append to variable)
2. For first list, Use Get Items - Get data from first list.
3. Use condition- Try to match employee code(or whatever is unique) between these list. When you do that it will take 'Apply to each' action automatically.
4. Once employee is matched then use another compose inside Apply to each to subtract second list leaves with first list leaves which we stored in a variable..
@darrenfloyd666 Looks like you're missing a comma between the two items.
It should be: sub(items('Apply_to_each')['Holiday_allocation'],triggerBody()['Days_requested'])
I set up two Compose actions earlier in the Flow and tried using them in the sub expression:
Sorry @SamPo realised that what I needed were just the number from the 'Holiday Allocation' field in the first list and the number from the 'Number of Days' Requested field in the second list. In the expression I'm finding the ' Number of Days' but I'm only getting the 'Body' and 'Value' values from the Get Items action from the first list. Any ideas how I get the 'Holiday Allocation' value from the first list to use in the expression.
All help welcome.
Check your Get Item Action. are you using any view under advance section in Get Item Action. Please provide image of your get item Action.
Check out the News & Announcements to learn more.
Participate in the Power Virtual Agents Community Challenge
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.
DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.