Take the 2-minute tour ×
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It's 100% free, no registration required.

I have a requirement where i need to change the workflow for emergency creation/updating.

Suppose i have a workflow X associated with creation/updating of a specific type of component. Workflow X has 2 step review process which takes Y days amount of time. Clients want to publish the component on an emergency basis for a special offer immediately, and at that time we need to trigger the emergency workflow Z.

How can i change the workflow from X to Z ?

I have one solution in mind which is as follows :

  • Associate the Workflow X in the component and add a additional field in Component metadata to which says "Trigger Emergency Workflow".Check the metadata field value to "Yes" for emergency workflow component and save it.
  • Capture the field value in event system . If the value is "Yes" change the workflow from X to Z .

Now my questions are :-

  • Is it possible to change workflow in event system from X to Z?
  • Can i get all workflows in event system ?
  • Once the metadata value is checked, i need to uncheck it after triggering emergency workflow. Can i do that i event system.
  • If i change the value of metadata to uncheck will it again trigger the normal workflow(X) . Can i stop it now?

Please give your suggestions

share|improve this question
add comment

4 Answers 4

First question is what version of Tridion are you using? In 2013 everything changes.

Anyway - to answer your question - I don't think there's any way to change the workflow your item is in apart from taking it through the workflow to a defined "exit" activity, and then putting it into a new workflow. That's rather the point of the whole thing, isn't it. There are plenty of things you can control a workflow from the events system, but this still won't allow you to evade the basic constraints.

It's quite common to see this kind of requirement with workflow - which is why you need to ask the hard questions at the beginning, and get commitments. Things like "we have a 100% governance requirement... everything must go through workflow... but we must be allowed to cheat if we want to." So the "correct" answer is probably to explain to them that their governance requirement is bankrupt, and please can you just take the workflow out altogether.

I fear that you may not succeed with that, so your alternative is to re-design the workflow so that there's a decision activity at the relevant place where they can choose a different branch within the same workflow, perhaps allowing a different assignee group to finish the workflow early.

share|improve this answer
    
Thanks for the quick reply @Dominic . We are using Tridion 2013 SP1 . Basically i will have one decision activity in place which will re-route the workflow to normal or emergency on basis of metadata value associated with the component. Can we get the metadata value in decision activity step which will eventually re-route the workflow or i need to use Event system to do this. –  Jitender sharma Feb 19 at 9:02
    
You don't need the metadata at all. –  Dominic Cronin Feb 19 at 12:18
add comment

I'm not 100% sure, but I think you can change process definition in GetProcessDefinitionEventArgs Class. I think it should be called when Tridion decides which process definition to use.

For all other question the answer is yes, you can do all of this.

share|improve this answer
    
Change the process definition of an in-flight activity instance? Surely not. Maybe we're reading the question differently. –  Dominic Cronin Feb 19 at 16:33
    
Indeed, I thought he wanted to choose which process to start from event system –  user978511 Feb 20 at 7:27
add comment

As I read it he wants to change the process (definition) being picked up. Two process definitions X (normal) and Z (emergency). It is true that process definition cannot be changed once the workflow has already started. However as @user978511 posts using event handler on GetProcessDefinitionEventArgs one can change the process definition being picked up.

    EventSystem.Subscribe<IdentifiableObject, GetProcessDefinitionEventArgs>(GetProcessDefinitionEventArgsHandler, EventPhases.Initiated);


    public void GetProcessDefinitionEventArgsHandler(IdentifiableObject source, GetProcessDefinitionEventArgs e, EventPhases phase)
    {
        e.ResolvedProcessDefinition = (ProcessDefinition) source.Session.GetObject(zProcessDefinitionId);
    }
  • Is it possible to change workflow in event system from X to Z? - Using event on GetProcessDefinitionEventArgs
  • Can i get all workflows in event system ? - yes ProcessDefinitionsFilter
  • Once the metadata value is checked, i need to uncheck it after triggering emergency workflow. Can i do that i event system. - I would recommend it doing in a first automatic activity in the Z workflow otherwise there might be potential deadlocks
  • If i change the value of metadata to uncheck will it again trigger the normal workflow(X) . Can i stop it now? - Once the checkbox is unchecked the next time this happens your GetProcessDefinitionEventArgs should not change/override the process definition and automatically it should start X workflow.
share|improve this answer
add comment

You don't need to change the workflow on the fly. Simply have both X and Z as conditional branches in the same workflow.

So after the initial activity add an automatic decision that determines if you have an emergency condition, and carry on to the "emergency branch" else carry on to the regular branch.

share|improve this answer
1  
This is similar to my point Nick, only that I'm saying it would be a possible next activity in a manual decision step. After all - someone will decide that it's an emergency. As I read the question, the metadata was part of an impractical approach that would use the events system. We didn't get to find out how the metadata would have been added, but surely at some point there's some user input involved. –  Dominic Cronin Feb 19 at 16:30
1  
I agree. Good point sir. –  Nickoli Roussakov Feb 19 at 18:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.