1

We have workflow which enables creator of list item to edit it later. Is it possible to associate workflow with certain list templates, so when user creates new instance of such list, workflow is there and does it job?

1

In SharePoint 2010 you can use SPListEventReceiver. This class contains handler to perform actions on ListAdded event. In this event you can retrieve list template from current list and compare it with needed template, if the tamplates are equal you can assigne the workflow to this list by code.

SPWorkflowAssociation workflowAssociation = SPWorkflowAssociation.CreateListAssociation(workflowTemplate, associationName, taskList, historyList);
workflowAssociation.AllowManual = true;
workflowAssociation.AutoStartChange = false;
workflowAssociation.AutoStartCreate = false;
workflowAssociation.AssociationData = associationData;
list.WorkflowAssociations.Add(workflowAssociation);
workflowAssociation.Enabled = true;
0

you can use this tool to associated event handlers with a list.

http://spstipsutilitypack.codeplex.com/

Good luck.

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.