We've all seen it happen and it ain't pretty.
Likewise performing an operation in a custom Script Action that causes the active record to be loaded can cause the WF manager to fall apart.
I've been researching why I was receiving logs like this:
26-MAR-2012 15:31:05.327 Initiated workflow
26-MAR-2012 15:31:05.372 Running ONENTRY trigger(Original trigger: SCHEDULED)
26-MAR-2012 15:31:05.390 Enter Scheduled Order Release
26-MAR-2012 15:31:06.099 Running BEFORELOAD trigger
26-MAR-2012 15:31:06.116 Running ONEXIT trigger
26-MAR-2012 15:31:06.117 Transitioning to Complete
Line #4 is where the problem is, the BEFORELOAD trigger should not be fired (IMHO). It's being caused by a call to nlapiPrintRecord() which I imagine behind the scenes is loading the record that is active in the workflow. The WF manager then detects this and switches context to deal with the new trigger.You don't see it in the logs, but it then goes back and executes the rest of the Actions in the Entry State but logs them against the Complete state. It's a mess.I REALLY want to use WorkFlows but this would be a deal breaker if this is the intended behavior. BTW, nlapiLoadRecord() will also cause this, so if you use a shared script component that loads a record deep down in it's bowels you will have your WF prematurely trigger and bail out of it's State.Anyone? Evan? - Does this seem like a defect or is this intentional?