Internal email when a draft order is completed and contains a timeline comment.

Hi Team,

Is there a way to create a Shopify flow that sends an internal email when either:

A draft order has been paid/completed AND there is a timeline comment,

OR

An order has been created AND the draft order had a timeline comment.

I’ve tried a few things but I can’t get it to work:

Thanks in advance,

Andrea

This is failing because it runs on Order Created, not ‘When order is created AND has a timeline comment’

So Flow is going:

An order is created (presumably, without any timeline comments)

Then it checks if it has any timeline comments (since it’s just been created, probably not)

So, it never sends the email.

Flow doesn’t let you create custom triggers in this way.

Some ideas:

You could run it on a time trigger every few minutes. (Use the trigger ‘Scheduled time’ → Repeat)

Then you’d use the action ‘Get draft order data’, set it to 100 - the maximum (then it will get all new draft orders, as long as there’s fewer than 100 since you last scheduled this)

Set the query to something like status:OPEN

Then, use a loop action ‘For Each Item in getDraftOrderData’

Then you can add a condition on that list of draft orders, like:

getDraftOrderData_item.hasTimelineComment = True

Then add an action to send your internal email

Haven’t tested it, but I think that should work

What it does:

Every x minutes, it gets all open Draft orders.
It loops through each draft order in the list
Checks if they have a timeline comment
If it does, it sends an email