Dynamics 2011 - updating workflow changes

142 views Asked by At

Trying to get my head round a workflow issue in Dynamics CRM 2011. I have a date dependent recurring workflow that is currently live.

I have realised I need to change it so I go ahead and make the change. (In Dynamics CRM 2011, to do this I have to strip out the condition block and redo it).

Anyway I do this and save it.

Now my issue is that the records that were using the workflow before I made the change are still using the old workflow and not the updated version.

Has anyone come across this bug and if so is there a way to force records use the most recent updated workflow?

2

There are 2 answers

1
Josh Painter On

The other answer is correct but doesn't solve your problem. You need to break up your workflow into two workflows: one that waits on your wait condition (the "waiting" workflow) and one that actually does something (the "action" workflow). The "waiting" workflow will call the "action" workflow as a Child Workflow when the wait condition is satisfied.

This way, the "waiting" workflow will always call the latest version of the "action" workflow.

You can also deactivate and edit the "action" workflow without deactivating the "waiting" workflow. If by chance a wait condition is satisfied while you are editing the deactivated "action" workflow, the "waiting" workflow will simply throw an error when it tries to call the deactivated "action" workflow. These "waiting" workflows can easily be "Resumed" after you finish editing the "action" workflow and re-activating it.

3
Henk van Boeijen On

This is not a bug, but a feature.

Once you have activated your workflow, the system creates a copy of your Workflow Definition. This copy is the WorkflowActivation instance.

When your activated workflow is triggered, a reference is created to this WorkflowActivation record and your Workflow Instance (an AsyncOperation record) will be executed according to its definition. (Remember, a workflow instance can be live for a long period of time.)

The Original workflow definition can be edited when needed, but these edits will not affect (or harm) running workflow instances, because the latter only depend on their specific WorkflowActivation instance. When the revised workflow definition is activated, the system creates a new WorkflowActivation instance that lives side-by-side with previous versions.

As soon as the last workflow instance depending on a workflow activation has completed, the outdated activation version is automatically removed by the system.

So, you are free to modify faulty workflow definitions, but your modifications have no effect on running workflow instances.