I have a loop and I would like to exit the loop once I have found a value with a particular status in the loop. How can we do this using the LOOP_BEGIN and LOOP_END scenario?
var hasOpen = false;
hasOpen = true;break; // doesn't work!!
Currently, this is not supported. Please raise an enhancement request.
Another possible solution is to define the looping construct within a JS function. In the JS function, add a return statement on the break condition.
return true; // condition to break
Note: Loop template tokens in RB are pre-processed and a copy of embedded statements within a loop is added for each loop record with record specific values. This is done before the JS engine (browser or server-side) interprets the JS code snippet. Hence, it is not considered as an optimal approach for a large number of records esp. for employing static checks. This is more suited for creating HTML markup for each loop record and other similar use-cases. As suggested by Srinivas above, leveraging API support will be more relevant for this requirement.