DC Workflow - using scripts to accomplish what i want

In a previous post i was asking about modifying DC WF to accomplish a few tasks that would be useful to me: In Workflow, How to Use "Return" tansitiion - #3 by dieter
@dieter explained well why DC WF is important to plone and should be kept simple and not tweaked for edge cases like I was proposing.

So, i reconsider my approach and I am trying to figure a way to use the existing WF options to accomplish what I want.


What I am looking for

  1. My WF is fairly complicated with about 5 to 6 states and the needed transitions. Some of these transitions "return" or 'reject' the content back to the previous owner/state.
    However, "Previous State" is not an option when creating a transition, thus i had to create a "Return" for each of the instances where i needed a return transition. (e.g. "Return to , return to ")

  2. I want One transition called "Return' which would return the object to the previous state.

My Thought

  1. I create the "Return" transition and i assigned "Remain in State" . so no action takes place during the running of the transition.

  2. however, I would use the "Script (after)" option (I assume that means it runs after the transition). i would use a script to move the object back to the previous state (which is one of the 4 pieces of data kept for each object.

thoughts? can someone help with the expression needed (I assume it is the expression used in transition).

thanks for any thoughts or ideas.

Wayne Glover via Plone Community wrote at 2024-5-16 05:32 +0000:

...
What I am looking for

  1. My WF is fairly complicated with about 5 to 6 states and the needed transitions. Some of these transitions "return" or 'reject' the content back to the previous owner/state.
    However, "Previous State" is not an option when creating a transition, thus i had to create a "Return" for each of the instances where i needed a return transition. (e.g. "Return to , return to ")

  2. I want One transition called "Return' which would return the object to the previous state.

My Thought

  1. I create the "Return" transition and i assigned "Remain in State" . so no action takes place during the running of the transition.

  2. however, I would use the "Script (after)" option (I assume that means it runs after the transition). i would use a script to move the object back to the previous state (which is one of the 4 pieces of data kept for each object.

Why? Why is "Remain in State" not enough?

I do not think that you should restore the previous state completely:
An action has taken place - and, at least in many cases, this
action should get accounted.

If you need some aspects of the former state restored, you can
use a (before-) script to save those aspects (e.g. in the request object)
and restore them in an after_script.