Friday, March 20, 2015

SharePoint 2013: How to set the hyperlink list column values from Workflow

Tip

Workflows can be used to set the values of both Picture and Hyperlink list column-types. The Picture column-type has just a single value, URL, that you can set.  The Hyperlink column-type, however, has two values: URL and Description.  So, if you create a workflow tied to a list having this column type, and then you try to set both these values, well..., you don't see either of these fields show up in Designer!  You just see the name of the column.  So what do you do?  How do you update both values with a single workflow Set statement?

Simple: if you want to set both the URL and the Description values of this column-type, you must enter them both into the value area, but separated by a comma ",".  That's it.  It really is that simple.  Let's examine this more closely.

Review

Here's a table that has been configured with Choice and Hyperlink column types.
The Choice column has been configured with three values: Nature, Science and Space.
And here's a workflow created on this list.  The workflow is triggered on change of the MyChoice column. Setting the column to a new value triggers the workflow to set the MyLink column, as determined by the If-branches:
If you look closely, you can see that the MyLink column is being set to two values separated by the comma:
The first value must be the URL; the second, the Description.  Let's create a new item, and then change it to see the workflow in action.
Opening up this list item in edit mode, we can see that both the URL and Description properties were in fact set:


References
  • Many thanks to Jonathan Adams with Serious SharePoint for posting the simple solution to setting hyperlink column types from workflow.  His posting was for SharePoint 2010, but is still applicable to SharePoint 2013.
  • Note that the column that shows the status of a specific workflow does not become available until you actually publish the workflow.  Thus, if you want to add the workflow status column to a list view, you have to wait until you publish the workflow before you can do this.

No comments: