1

I have created Reusable Workflow through Sharepoint designer (Sharepoint foundation 2013) and associated with site content type.

Now, I have saved this as a template(eg: TestWf.wsp). I have to deploy this in production(Sharepoint Foundation 2013) environment, for this I manually created same Site Content Type in production environment and import wsp file.

Here I can able to see that the Workflow in imported successfully but it was not associated the Content type and when I am trying to associate with it Content type(option available in Ribbon in sharepoint designer 2013 foundation) it was not visible.

Please suggest where I am doing wrong.

0

You are not doing anything wrong. From MSDN: "Unlike previous versions, SharePoint 2013 does not support workflows that are scoped to a content type (SPContentType). [...]"

However, after moving your reusable content type to a different site, you can associate it with a list using this PowerShell script:

$wfm = New-object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($Web)
$defSevice = $wfm.GetWorkflowDeploymentService()
$wfDefs = $defSevice.EnumerateDefinitions($false)
$wfDef = $wfDefs | where {$_.DisplayName -eq $WorkflowName}

$wfDef.RestrictToType = "List"
$wfDef.RestrictToScope = $ApprovalListId
$defSevice.SaveDefinition($wfDef);

$wfsubService = $wfm.GetWorkflowSubscriptionService()


$sub = New-object Microsoft.SharePoint.WorkflowServices.WorkflowSubscription
$sub.DefinitionId = $wfDef.Id
$sub.Enabled = $true
$sub.Name = $wfDef.DisplayName

$startOptions = New-Object "System.Collections.ObjectModel.Collection[System.String]"
$startOptions.Add("WorkflowStart")
$sub.EventTypes = $startOptions

$sub.SetProperty("HistoryListId", $HistoryListId)
$sub.SetProperty("TaskListId", $TaskListId)

$wfSubService.PublishSubscriptionForList($sub, $ApprovalListId);

Make sure your content type (with all the columns) is on the list already.

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.