0

I have a state machine workflow and when that workflow completes ( I am using workflow completed event handler) i am starting another state machine workflow using the following function

public void StartWorkflow(string wfName)
    {
        SPSite site = workflowProperties.Site;
        SPList parentList = workflowProperties.Item.ParentList;
        SPWorkflowAssociationCollection associationCollection = parentList.WorkflowAssociations;
        foreach (SPWorkflowAssociation association in associationCollection)
        {
            if (association.Name == wfName)
            {
                association.AutoStartChange = true;
                association.AutoStartCreate = false;
                association.AssociationData = workflowProperties.InitiationData;
                site.WorkflowManager.StartWorkflow(workflowProperties.Item, association, association.AssociationData);
            }
        }
    }

what is the best way to start a workflow when another workflow is completed and also to pass data between these workflows?.

Suggest me the best practice for implementing this scenario?

Please post me useful links.

Cheers.

2

To start a workflow when another workflow is completed, create workflow Event Receiver. The SPWorkflowEventReceiver class contains WorkflowCompleted method. The WorkflowCompleted method contains SPWorkflowEventProperties parameter, which can be used to pass data between workflows.

0

Since you asked for links, here's one: Workflow Events

For starting a workflow, refer to Starting a SharePoint workflow from code (Event Receiver)

What you need is to enable the WorkflowCompleted event and start your other workflow from there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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