1

Simply put, what is the difference between a "workflow subscription" and a "workflow association".

Here the two terms are used interchangeably.

I have created a workflow named MyWorkflow. When I associated it with my list I named the (what I used to call) association "MyWorkflow_officesupplyList" (...Im using sp online/csom btw)

2

1 Answer 1

3

Well, the story starts even before the WF subscription and association comes into picture. When we use CSOM, it is important to understand that how a workflow is invoked programmatically. There exist a Workflow service Manager which is responsible for getting all workflows for a site. In MSDN words, "This Describes the workflow host configuration states and provides service objects to interact with workflow instances."

Now lets talk about WF Subscription service and WF association.In simple words:

Workflow subscription service: It's one instance manages All workflow associations.

Workflow Association: It simply describes the association of a WF to a particular SharePoint component (e.g association with List or Site)

Needless to say that you will require WF subscription to get association. Please refer the sample code:

var workflowServicesManager = new WorkflowServicesManager(ctx, ctx.Web);            
var workflowSubscriptionService = workflowServicesManager.GetWorkflowSubscriptionService();              
var workflowAssociations = workflowSubscriptionService.EnumerateSubscriptionsByDefinition("guid-of-workflow");
ctx.Load(workflowAssociations);
ctx.ExecuteQuery();
4
  • ...but the example above is just a renaming. The var workflowsAssociations is of type WorkflowSubscriptionCollection. I was actually needing the real association, of type WorkflowAssociation
    – Cowborg
    Commented Jul 18, 2017 at 10:40
  • Yes it will give you the complete collection of workflow associations. That is all you need for one SharePoint component say SP LIST in your case. For complete reference refer this: github.com/SharePoint/sp-dev-docs/blob/master/docs/…
    – DvG
    Commented Jul 18, 2017 at 10:59
  • I did just that :) and it returns WSC, not WAC... it also says it here: msdn.microsoft.com/en-us/library/…
    – Cowborg
    Commented Jul 18, 2017 at 11:06
  • Yes ,correct! apology for my bad. As I explained in my answer, WF Associations are linked to List or content type so If you want to get the WAC, you need to hit list or content type through code. refer: 1. msdn.microsoft.com/en-us/library/… 2. msdn.microsoft.com/en-us/library/office/jj246466.aspx
    – DvG
    Commented Jul 18, 2017 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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