Continuing from my previous call for help - SharePoint 2013 Reusable workflow doesn't pick up fields in a different site collection
I assume you can associate SharePoint 2013 workflows with content types:
After I move the reusable workflow to another site collection, how can I re-associate it with a content type in that site collection. I am currently using PowerShell to associate it with a list but that doesn't seem to work very well.
> $wfm = New-object
> Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($Web)
> $defSevice = $wfm.GetWorkflowDeploymentService() $wfDefs =
> $defSevice.EnumerateDefinitions($false) $wfDef = $wfDefs | where
> {$_.DisplayName -eq $WorkflowName}
>
> $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);
Searched the intrawebz, but can't seem to find a solution on how to associate reusable workflows with content types. Can anyone shed any light on this? Proper ways or workarounds are welcome. Thanks.