Found an interesting gotcha today when trying to do some Business Process Flow scripting, and I didn't see it written about anywhere, so thought I'd throw it out here.
Let's say you use javascript to get the active stage, and then the step collection (using code similar to this - https://neilparkhurst.com/2015/11/01/crm-business-processes-and-javascript/). When you iterate, you may run into issues with some steps being "undefined". It looks like with the added ability of attaching workflows to stage changes, those now get returned in a call to stage.getSteps, but return as undefined. So let's say you have 3 fields as steps in your stage, and then 2 workflows set to go on stage exit. When you call stage.getSteps, your collection length will be returned as 5. 3 will be your 3 fields, and the other 2 will be undefined. So when you're iterating, you just have to add in a check for undefined before trying to get the name or any properties of the step, otherwise the js will throw an error.
*This post is locked for comments