SharePains

My Office 365 Pains = Your Office 365 Solutions

Office 365

SharePoint 2016 – Aaah, SharePoint Designer workflows!


Over the last year or so I’ve only really looked at the bleeding edge technology released by Microsoft. Microsoft Teams, Microsoft Forms, SharePoint Online, PowerApps and Microsoft Flow  and anything related have been very interesting.

Just before the 2017 year ends however I’m now working on a SharePoint 2016 project and it’s quite a challenge to go back to technology like SharePoint Designer workflows. Today one of those small problems that can be a bit of a challenge is to get the value of a Managed Metadata column.

I first went down the root of simply setting a variable to my column

But I bumped quite quickly into the following error as I was setting a string variable to the value of the Managed Metadata column:

Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.InvalidCastException: The value ‘d/results(0)/Location’ cannot be read as type ‘String’. at Microsoft.Activities.GetDynamicValueProperty`1.CheckedRead(String propertyName, DynamicItem value) at Microsoft.Activities.GetDynamicValueProperty`1.Execute(CodeActivityContext context) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Quite quickly I now found:

https://sharepoint.stackexchange.com/questions/156579/get-metadata-column-value-in-spd-workflow

So I went throguh these steps:

  1. Choose action – set variable to value

  2. In the value section (popup when you click value)- choose the data source as the list which you are fetching the column from –

  3. In the field from source – choose the managed metadata column internal name

  4. In the find in the list item section – choose the field tp be ID and value to be CurrentItem -> ID (should look like CurrentItem.ID)

  5. Click on OK. This should get you value of the managed metadata column.

  6. If you want, you can use the action Log item to the history list to check the value.

 

So I change my set variable step into something like this: where I selected my Location column again:

But still no luck. Then I tried the Location_0 column, Huh what is this. My internal name of the column is definitely Location and not Location_0

Then I simplified my step again and the Location_0 column did the trick again.

SharePoint 2016 – Aaah, SharePoint Designer workflows!

 

 

 

Advertisements

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: