Using the Loop Native Action
the loop native action repeats child actions in a playbook use a foreach loop to iterate over an array, or a while loop to repeat while a condition is true this topic focuses on while loop timing inputs starting in turbine 26 2 0 , delay and duration are labeled and entered in seconds in the canvas ui choose your path i want toβ¦ start here configure a while loop on the canvas configure a while loop /#configure a while loop understand delay and duration units delay and duration units (26 2 0) /#delay and duration units 2620 confirm upgrade impact for existing playbooks existing playbooks after upgrade /#existing playbooks after upgrade use playbook expressions for timing playbook expressions /#playbook expressions configure a while loop add a loop action from the canvas add panel on the action details panel, set type of loop to while click edit condition and define when the loop should continue click configure to open the while loop inputs set delay (in seconds) , duration (in seconds) , and limit as needed add child actions on the loop entry branch and save the playbook input description condition boolean expression that must be true for the loop to continue delay (in seconds) wait time before each iteration after the first duration (in seconds) maximum time the loop may run limit maximum number of iterations allowed use limit and a well defined condition together so a while loop cannot run indefinitely duration provides an additional time based guardrail delay and duration units (26 2 0) before turbine 26 2 0 , the while loop delay and duration fields accepted numeric values in milliseconds , but the canvas did not show the unit users often assumed seconds , which caused loops to wait or run much longer than intended starting in 26 2 0 field what you enter in the ui what the playbook stores delay (in seconds) seconds (for example 2 ) milliseconds (for example 2000 ) duration (in seconds) seconds (for example 10 ) milliseconds (for example 10000 ) the canvas converts static numeric values when you open and save the while loop dialog on load β stored milliseconds are divided by 1000 and shown as whole seconds in the ui on save β whole number seconds you enter are multiplied by 1000 before the playbook is saved the turbine engine still evaluates delay and duration in milliseconds at run time existing playbooks after upgrade the 26 2 0 unit change is ui only playbook json and api payloads are not migrated to a new unit stored value (unchanged) what you see after upgrade run time behavior delay = 2000 2 in delay (in seconds) still waits 2000 ms (2 seconds) between iterations duration = 10000 10 in duration (in seconds) still stops after 10000 ms (10 seconds) total loop time existing customer playbooks keep the same timing after upgrade the ui displays equivalent seconds for clarity; run time does not change unless you edit and save new values if you open a while loop, change delay or duration , and save, the ui saves your entry as seconds converted to milliseconds review timing after edits to avoid unintentionally longer or shorter waits playbook expressions you can map delay , duration , or limit to playbook properties or expressions instead of static numbers value type ui behavior run time behavior static number shown and edited in seconds ; converted to milliseconds on save engine uses stored milliseconds expression or property reference passed through without seconds conversion in the dialog evaluated result is treated as milliseconds by the engine if you use an expression for delay or duration , supply or calculate values in milliseconds even though the field label says seconds for example, to wait two seconds via a variable, the evaluated value must be 2000 , not 2 see also organizing playbook in the canvas https //app archbee com/docs/wdlpsa7glls1ghfgxbo9d/ds geaogh 2ujxg roys β canvas tools, loops, group , and tool panel components https //app archbee com/docs/wdlpsa7glls1ghfgxbo9d/c7ipcs5ndr9sgu4z6pjs0 β loop nesting depth limits