Hi,
Is it possible to change the transitions options based on a field value of an object?
eg. I have an object. The workflow is the Initiator adds the object, it goes to depthead and then to either the dean or VP depending on whether a field (school) is null or not.
I am thinking of 2 approaches for this. Don't know if either is viable.
When the object is created, check if the school is null and assign the appropriate workflow. If this is doable, what would the code snippet look like.
When the the Initiator sends the object for review to the depthead, change the workflow based on the value in the school field.
You can use a guard expression that checks the value of a field before a transition becomes available. You can also use an automatic trigger and guard directives to 'route' the item to other states.
I dont think I would NOT go for the 'change Workflow'. I would use guards.
A bit off topic, and probably not a good idea, but it is possible to have the title of two transitions 'the same', but they do different things. If so, when 'X' publishes (transition x_publish) it moves to state 'xx', but if 'Y' publishes (transition y_publish) it moves to state 'yy'. For the users, it 'looks the same'.
Also: You could add a content rule that moves for example an item into 'some_state' (published for x) if 'some condition' and transitions can also be 'automatic' (in your case if something is true (but I think a content rule is much easier to make).
We did something similar using a content rule that set a local role on the object. Then then who did the review was set based on the who had the review role. You could also use the role to determine which transition was available, esp eith a custom role.