How to set the Advenced "Edit query" of "GetOrderData" for Payment Schedule Flow

As below picures show, i’m trying to “Get Order Data”, then “add order tags”, when PaymentTerms → PaymentSchedules of the order are less than or equal to 0. So i can know when the customer paid the overdue payment and how many days the customer delayed to pay.

Last time, i was told “ This can be done by adding a ‘Get Order Data’ step and using paymentSchedule.paymentTerms.order.id as the order_id in the query section. Next, they should iterate over the results and execute the ‘Add Order Tags’ step”.

I tried add "order_id:{{ paymentSchedule**.paymentTerms.****order.**id }}, and / or

**order_**id:{{paymentSchedule.paymentTerms.order.legacyResourceId}}", and / or

id:{{paymentSchedule.paymentTerms.order.id}}, OR
id:{{paymentSchedule.paymentTerms.order.legacyResourceId}}.

But all failed (except i got the email to notify me that the order get full payment).
Would someone here give me a hand to tell me where is the error, and how to fix it?

Thank u!!!

Hi @EunorauEbikes ,

The search syntax is:

id:{{someVariable.legacyResourceId}}

So that is how you should construct the query.

It would be worthwhile to add a Log Output step in the same branch as the Get Order Data action and set it as the same query string you’re computing. This will let you know what the query looks like and you can continue to debug it. On the Order list page, you can copy + paste the output of the Log action into the query field – it accepts the same syntax. It’s possible that the query string is malformed or that some of the data does not exist. Debugging with the Log action is probably the best way to get to the bottom of what’s happening.

Hope that helps!

Thanks u, i will try it, and others you said are valuable for me too.

An error here - ““someVariable” is invalid. Replace this variable.”

You need to change the someVariable to the actual variables from the workflow. I was just providing the syntax, That’s how it works for all Get data actions. More info can be found in the Shopify API Search Syntax docs, which should be linked from that action.

id:{{paymentSchedule.paymentTerms.order.legacyResourceId}}