Update Running workflow with dynamicUpdateMap

84 Views Asked by At

I have a workflow running and i'm trying to update it dynamically. It is a Flowchart and i'm trying to change the Next property of a FlowStep. The problem is that when loading WorkflowApplication.Load(workflowApplicationInstance, map); the instance with the map, i got the error:

In order for an implementation map to be directly applied to a workflow instance, the root of the definition must not have any public/imported children or public/imported delegates.

i tried saving the map to file and to database, because i saw in other examples, the map is saved with extension file.map not file.xaml of file.xml. Anyway it was useless, it's still not loading.

1

There are 1 best solutions below

0
Emilian Manase On

Solved that. The problem was when calling PrepareForUpdate and CreateUpdateMap methods, from their API, i was calling them with ActivityBuilder parameter and it should have been Activity. So having the ActivityBuilder of a workflow you can obtain the activity of it like this:

ActivityBuilder workflowDefinition; Activity flowcharWorkflow = workflowDefinition.Implementation as Flowchart();

if your workflow definition has a root of flowchart.