list template and associated workflow RRS feed

  • Question

  • I have an requirement where I have created an standard list with that list there are 2 workflow attached to it.

    so requirement is I want to create an list using list template which I have saved for pervious list.so when list is created from template I want workflow should be automatically get attached to new list as well.

    I want to archive  this by oob and designer workflow only .

    Please help me in this .


    lalit kasa

    Regards, Lalit Kasa lalit.kasa88@hotmail.com

    Wednesday, May 11, 2016 10:33 AM


  • Hi,

    There is not any out of the box way to include workflow with list template using UI approach save list as template, You can use the powershell script to get all workflow associated with your lsit  and save them it will save as xml.

    $myWFColl = $myList.get_WorkflowAssociations()

    For ($i=0; $i -lt $myWFColl.get_Count(); $i++)


       $thisAssociation = $myWFColl.get_item($i)

       $saveTo = $localFolder + $thisAssociation.get_name() + ".xml"

       $exportedAssociation = $myWFColl.get_item($i).get_associationdata()

       $exportedAssociation >> $saveTo


    In your destination environment you can use the Import List command and attach the saved workflow template to your list.

    $newWeb = Get-SPWeb -Identity $newSiteAddress #SPWeb object

    $newList = $newWeb.GetList($newListPath) #SPList object

    $newHistoryList =  $newWeb.GetList("/siteURL/Lists/Workflow%20History")

    $newTaskList = $newWeb.GetList("/siteURL/Lists/Tasks")

         $xmlFile = $localFolder + "File Validation.xml"//Name of your workflow

        $associationData  = Get-Content $xmlFile

        $newListWFTemplates = $newWeb.get_WorkflowTemplates() #SPWorkflowTemplateCollection object

        $newFeedback = $newListWFTemplates.GetTemplateByName("WF Name", "en-us")

        $validationAssociation = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListAssociation($newFeedback, "File Validation", $newTaskList, $newHistoryList)




         $xmlFile = $localFolder + "Approval Workflow.xml"//Workflow Name

        $associationData  = Get-Content $xmlFile

        $newApproval = $newListWFTemplates.GetTemplateByName("Approval Workflow", "en-us")

        $approvalAssociation = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListAssociation($newApproval, "Approval Workflow", $newTaskList, $newHistoryList)





        $approvalGUID = $approvalAssociation.get_Id();


        $xmlFile = $localFolder + "Collect Feedback Workflow.xml"

        $associationData  = Get-Content $xmlFile

        $newApproval = $newListWFTemplates.GetTemplateByName("Collect Feedback Workflow", "en-us")

        $collectAssociation = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListAssociation($newApproval, "Collect Feedback Workflow", $newTaskList, $newHistoryList)





        $newWFAssociationColl = $newList.get_WorkflowAssociations()






    SharePoint Architect



    Please click "Mark As Answer" if this post solves your problem or "Vote As Helpful" if it was useful

    Wednesday, May 11, 2016 2:38 PM