Hello everyone,
I have a workflow where, after creating a new Product, I look up all possible Color and Size combinations, and then use Schedule API Workflow on a list to create multiple SKUs (one per color/size combination). After those SKUs are created, I want to set the Product’s SKU[R][List]
field to match all the SKUs actually found in the database (i.e. Search for SKUs where Product = This Product
). However, sometimes the SKUs take a moment to finish creating, so I want a recursive or looping workflow that checks:
- If
(Search for SKUs:count) != (Product’s SKU[R][List]:count)
, - then wait a few seconds and try again,
- until they match, at which point I do a final “set list” or confirm it’s done.
My current attempt uses a backend workflow with an “Only when” condition like
Only when Search for SKUs:count is not Product’s SKU[R][List]:count
and then schedules itself again. But it appears to evaluate the condition at the time I schedule the workflow, not at runtime, so it never loops properly. It either never triggers or triggers indefinitely if the values were different at scheduling time.
Has anyone set up a stable approach where I can:
- Create the SKUs in bulk via API Workflow on a list,
- Then keep re-checking (and re-scheduling) until the newly created SKUs are recognized in a search,
- And only then finalize
Product’s SKU[R][List]
or confirm the count is correct?
I’d love any tips on how you handle the real-time search vs. the “Only when” pre-check, as well as how to avoid infinite loops. Thanks in advance!