You are inside an Apply to each, you want to check:
Whether DateClosed is empty
And whether 2 or 4 days have passed since CreatedOn
Step 1: Inside the Apply to each:
Add a Compose step
Name it: DaysElapsed
Expression:
int(
div(
sub(
ticks(utcNow()),
ticks(items('Apply_to_each')?['createdon'])
),
864000000000
)
)
Place this immediately under the Apply to each.
This calculates whole days since createdon (UTC to UTC).
No string/date mismatch, because ticks() works with DateTime directly.
864000000000 = ticks per day.
Step 2 — Replace your current Condition with this Condition
Click Condition → Edit in advanced mode, then paste the relevant formula.
Condition for Escalation Level 1 (2+ days, but less than 4): (please modify it as per your requirement)
@and(
empty(items('Apply_to_each')?['DateClosed']),
greaterOrEquals(outputs('DaysElapsed'), 2),
less(outputs('DaysElapsed'), 4)
)
If Yes → send Level 1 escalation email
If No → check Level 2 condition
Step 3 — Add a second Condition (for 4+ days)
Expression:
@and(Closed']),
greaterOrEquals(outputs('DaysElapsed'), 4)
)
If Yes → send Level 2 escalation
If No → do nothing
✅ If this answer helped resolve your issue, please mark it as Accepted so it can help others with the same problem.
👍 Feel free to Like the post if you found it useful.