I need to get the last item from a grouping

Hello,

I have two databases

  1. Approval
  2. Approval Tracking

In the approval tracking, there are 2 important fields

  1. Approval = Approval
  2. Approval User = User

Every time a user approves an approval, it creates a new approval tracking with the next user.

I want to send a daily email reminder to the last person in an approval, to remind them to approve the form. I am trying to do “Search for Approval Tracking: grouped by Approval” but I don’t know how to identify the last person from the approval. Also, after they approve, I no longer want to send them the email

Would this work?

  1. Set up a daily recursive workflow that searches for Approval Tracking:sorted by created date:last item
  2. Check whether it’s approved or not
  3. If yes, stop running, if no, schedule API workflow to send reminder email.

If there could potentially be multiple Approval Trackings awaiting approval, you could remove the :sorted by date, and simply return a list of all unapproved Approval Trackings.

Hey @petter

So, the approval trackings are linked to the approvals table. For example

Approval Table
Approval #1
Approval #2

Approval Tracking Table
Approved - User 1 - Approval #1 - 16th November
Approved - User 2 - Approval #1 - 17th November
Approved - User 3 - Approval #1 - 18th November
Approved - User 1 - Approval #2 - 21st November
Approved - User 2 - Approval #2 - 22nd November

The email needs to be sent to Approved - User 3 - Approval #1 - 18th November and Approved - User 2 - Approval #2 - 22nd November everyday until they approve

Gotcha! I think the method I outlined above should still work. Essentially, it will be checking every day, based on the criteria you provide in conditions, what Approval Tracking records require an email to be sent.

I’m assuming you store it on a field on the Approval Tracking record when it has been approved, which you can then use to “filter” them out from the list in the daily recursive workflow. So to sum up in plain english: every day, your app searches for unapproved Approval Tracking records and returns a list of those. Based on that list, you use Schedule API workflow on a list to send an email to those users.

If the initial search returns no records, then it won’t send anything.

Am I reading your situation right?