Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
It is best to keep the code in the expression robots (or transitions) in the Workflow Administrator to a minimum. IMHO, the best approach is to have a single line of code in the expression robot that calls a method that actually "does the work".
For example, in a "validate" expression robot, we would have only one line of code to call the validation routine:
validationResponseVariable = ext.mycompany.WorflowHelper.validate(primaryBusinessObject);
Using this approach allows you more flexibility in maintaining your workflows. Each workflow controlled object gets a new instance of the workflow template (as the tempalte exists at the time of object creation,) and any code within the workflow becomes immutable (cannot change) for a given object instance.
By keeping the actual logic in an external class, you will have the flexibility of changing the implemetation details (business logic) and having those changes be applicable to any existing objects calling the external logic without assigning new workflow processes.
Our rule is generally "one line of code per robot - and that line of code should call one of our classes"
I hope this helps.
Todd
