Asynchronous error / wait in loops

Hi guys, I have a problem when executing a javascript function, I have two triggers (restapi) that one depends on the other
should run in this sequence:
trigger1
trigger2
trigger1
trigger2
trigger1
trigger2

follow the demo image:

You can use .then.

gerar_cupom_trans.trigger().then(
  () => anotherQuery.trigger()
)

This solution not work, but i changed the foreach to one for and it worked

1 Like

Aye, glad it did :metal: