Hello, there. I’m JongHwa Lim, a PM in the SharePoint Designer team. Long time no see. Some people might have considered this site dead because there have been no new posts since April of last year but we are back. We will keep this site alive and will post new blogs at least every month and try to keep connected to readers and customers.
To warm this site up (and also warm my team up for upcoming posts), let’s start with a small but very useful feature new in SharePoint Designer 2010 (aka. SPD).
Let’s first start off by setting a scenario. You are a workflow author who is used to using SPD and you are required to make a workflow that should be used in many lists or document libraries with some workflow-specific fields. How do you implement it? Here are some examples of choices you might try to achieve this goal.
· List workflow
o You can start from list workflows. You will add the workflow specific fields to the list directly. And during design time in SharePoint Designer, you can see the fields and create your workflow logic using those fields.
o But when it comes to reusing this workflow in other lists or doc libraries, you don’t have good answer for it.
· Reusable workflow
o You are a little bit more familiar with SPD workflows so you choose to go with reusable workflow which will resolve the reuse issue. But as you open the workflow designer, you end up seeing only ‘Title’ for settable field and seeing ‘Content Type’, ‘Created’, ‘Created By’, ‘ID’, ‘Modified’, ‘Modified By’ and ‘Title’ for readable fields.
o You cannot use the fields you need to make the workflow logic.
· Reusable workflow with base content type
o You are an advanced user of SPD workflow so you know the concept of base content type for reusable workflow.
o First, you create a new content type and add the necessary fields to the content type. And in the ‘Create Reusable Workflow’ dialog, designate the content type you created as the base content type.
o Now you can see the fields in the workflow designer and you can achieve what you are required to do. This has no issue with reuse scenario as long as you associate this workflow with the content type and the content type is added to the list or document library.
o But what if you found out you need a new field? Every time you need a new field, you have to go to site content type or the site column UI either on the server or on SPD.
o Another weakness still exists. When you want to move your workflow using ‘Save as Template’, the unpackaged workflow will lose some information on the base content type if the base content type is a custom content type or the content type contains a custom site column.
· Reusable workflow with association column
o You are almost as familiar with SPD as the one who knows base content type concept. So you know the concept of association column.
o As you start authoring the workflow, when you need a field, you just create it right away with association columns, where you can choose between an existing site column and a new one. You don’t go back-and-forth all the way among workflow designer, site content type, and site column UIs. You can do everything in one place and that’s it.
o In addition, there is no issue with reuse because reusable workflow definitions carry the fields with it and workflow package supports it.
Now, some of you may have tried to find help files on this topic. Here are some examples of what can be found:
· Reusable workflows, by default, don’t have the context of a specific list or library. Therefore, by default, they provide only the columns that are common across lists and libraries, such as Created and Created By. If your reusable workflow requires certain columns to be present in the list or library that you associated it to, you can add those columns as association columns. Association columns get added automatically to a list or library when a reusable workflow is associated to that list or library.
· Association columns If your reusable workflow requires certain columns to be present in the list or library that it is associated to, you can add those columns as association columns. Association columns get added automatically to a list or library when a reusable workflow is associated to that list or library.
· (Tooltip of Ribbon button) Define columns that will be added to a list when the workflow is associated with that list. This option is unavailable for site workflows.
All these descriptions are completely true and perfectly explain what association columns are and what it is for. Association columns were introduced by because of the real world scenario that there is no good experience for reusable workflow authors when they want to update the fields of the ‘current item’. As we didn’t have a ‘reusable workflow’ concept until SharePoint Designer 2010, we didn’t have association columns, either. Without association columns, the only alternative may have been to use base content type. But, this also put various limitations in terms of association and design time UX because it could only be associated to the base content type or inherited content types and the author should go from workflow designer to site content type or site column UIs several times.
Creating an association column is straight forward. I will show you with an example. As shown below, you can start with the Ribbon button named ‘Association Columns’.
If you click on it, a warning dialog will pop up like below.
If you select ‘OK’, you will be directed to the main dialog for association column.
You can choose from ‘Select Site Column’ and ‘Add New Column’. If you select site column, the following dialog will be presented.
If you select Address field, it will be added to the main dialog.
If you add new column, following UI will be shown where you can define a new column.
In this example, I’ve created a multi-line text field named ‘Comments from Approvers’.
You can see that when a new column is selected, Modify is also enabled but it will be disabled for any existing columns.
If you click ‘OK’, you are done with the association column. Now you can see ‘Address’ and ‘Comments from Approvers’ in the designer surface.
Internally, association column is using site column so that’s why you can see option ‘Select Site Column…’ button in the UI. The association columns whether it is newly created or chosen from site columns are persisted in the wfconfig file so that it can be used during design time.
But if you look at the wfconfig before you publish the workflow, you can find the following field definition. This is because we create site columns during publishing time and update the corresponding field definition in the wfconfig.
So if you revisit the association column dialog after publish, you can see the difference that ‘New Column’ changed to ‘Existing Column’ and you are not allowed to modify it.
And when the reusable workflow is associated to the list or document library, we add the association columns to the list and document library so that the reusable workflow referencing the fields work just fine.
If you package the reusable workflow and un-package it in another site, the association columns are kept, meaning that association columns are also packaged and unpackaged. On the other hand, custom base content type and custom site column in the base content type are not fully packaged, meaning that there could be information lost during the transfer.
When we associate a reusable workflow to a content type, the association columns are added to the list or document library when the content type is added to the list or document library. We do not add the association columns directly to the content type.
Nice information and also hopefully you will keep update :)
Very interesting. I did not know that Association Columns even existing prior to reading this post. Thanks very useful information!
"Very interesting. I did not know that Association Columns even existing prior to reading this post. Thanks very useful information!"
Is this perhaps a means of attaching a workflow to an external list? If we create an association column for, e.g. status of an item (multi-choice, say: Not Started, In Progress, Draft, Approved, Obsoleted) which the reusable workflow can manipulate, is this then possible to attach to an external list in the same way that it could be attached to an internal list?
I hope someday your team will understand that people would like to loop through a sharepoint list do some calculation and if all is ok add new item (and if not ok dissalow update list).
Most of these tricks are so horizontal (speaking in tables) that a lot of my custommers look for other products because we cannt use it for work, i'm thinking personally to start PHP + MYSQL + Python; because MS solutions are so troublesome to get simple things done.
Very useful, I'd wondered about these columns for a while.
A very good explanation on why to use and how to use association column.