I need to move an operator to be able to recall a workitem back after submitting it to a new stage. I tried the pyChangeStage flow action and the change stage smart shape. It didn't work as I expected. It looks like it splits the work item and leave one where I am and creates a new item at the next stage. It's very odd. I referenced SR-109756 because it looks like this may be a know bug. I'm using 7.1.8. If anyone has solved this thorugh some other mechanism, please let me know.
As I understand it this is the expected behavior. When you change stage you haven't completed the assignment from the stage / step that you were in originally so it is left there.
There is an option to clean this assignment up when you use the change stage smart shape and this is the funtionality that you are looking for... but this is not made available by default in the pyChangeStage flow action.
E.g. Change Stage Smart Shape:
I am not sure why it is not available on the flow action. I assume it's becuase it isn't supposed to be user facing option and this stuff should be considered part of the application design. You can update the rules to enable it though.
pyChangeStage flow action calls the pyChangeStage activity which in turn calls pxChangeStage, but does not set the CleanUpProcesses parameter. In fact pyChangeStage activity dosn't even have this parameter defined. As you can see below this parameter is always unchecked. i.e. by default we do not clean up assignments when switching stage.
How you handle this will depend on if you always want to clean up the open assignments, or have it optional. I am not sure if there is a best practice here so perhaps someone else might be able to advise on that, however the most simple option would be...
The pyChangeStage activity is available so you could simply save it into you applicaiton ruleset and check that CleanUpProcesses parameter on step 3 and 4 where it is used. This will mean that assignments will always be cleaned up when using the change stage flow aciton in this application though.