Console FAQ

How to start and implement a custom workflow from a custom tree

How to start and implement a custom workflow from a custom tree?

Answer:

Use the following minimal syntax in the tree markup:

<WorkflowAction Label="MyLabel" WorkflowType="MyNamespace.MyWorkflow"/>
When implementing the workflow you might need to find some data item in the parent path of the tree. For example if you need to get the id of the a parent data type and use this as to populate a reference field of a new child data element.

You can obtain the piggybag with the following code:

Dictionary<string,string> piggybag = PiggybagSerializer.Deserialize(this.ExtraPayload);

And get the parent data item with the following code:

DataEntityTokendataEntityToken = 
  piggybag.GetParentEntityTokens().FindDataEntityToken(typeof(IMyType));

IMyTypeparentMyType = (IMyType)dataEntityToken.Data;