http://msdn.microsoft.com/en-us/sp2010devtrainingcourse_workflow_unit.aspx
Workflow tutorial run through from Visio to declarative.
http://msdn.microsoft.com/en-us/library/gg615452.aspx
Create and deploy a declarative workflow.
http://msdn.microsoft.com/en-us/library/ff798386.aspx
Import and package a declarative workflow.
Add fields to task form in a SPD workflow.
Calling a subworkflow programmatically.
However there is the Enabled property. When you set a workflow attached to a list to No New Instances, the Enabled property will be False. So with a minor tweak to our LINQ query, we can make sure that the only result returned by it is a workflow association template that both matches our base template Id and is allowed to start new instances on that particular list.
Guid svpwfid = new Guid("4e126fc9-6b12-1212-8c21-21120f264bad");
var wfa = (from SPWorkflowAssociation spwfa in workflowProperties.Item.ParentList.WorkflowAssociations
where spwfa.BaseId == svpwfid && spwfa.Enabled == true
select spwfa).FirstOrDefault();
Now that we have our query in place to get the proper workflow association template, we can instantiate the SPWorkflowManager object for the site, and pass it along our workflow association, the association data, our list item, and the bool flag for the auto start property through its StartWorkflow() method.
Full implementation would look like this:
Guid svpwfid = new Guid("4e126fc9-6b12-1212-8c21-21120f264bad");
var wfa = (from SPWorkflowAssociation spwfa in workflowProperties.Item.ParentList.WorkflowAssociations
where spwfa.BaseId == svpwfid && spwfa.Enabled == true
select spwfa).FirstOrDefault();
if (wfa != null)
{
SPWorkflowManager wfMan = workflowProperties.Item.ParentList.ParentWeb.Site.WorkflowManager;
wfMan.StartWorkflow(workflowProperties.Item, wfa, wfa.AssociationData, true);
}
else
{
// could not find workflow template.
}
Summary:
And that’s how you find and start a workflow, from another workflow.









