Have you ever seen one of those game shows where some poor slob humiliates himself and embarrasses his entire family but gets every answer right and is given a key that might start a car? The car is there, all bright and shiny and the key might start that car, but the guy is given the option to take $150 in cash and $200 worth of cereal coupons instead of trying that key. Of course, he tries the key and the car doesn’t start. Well, that’s how SharePoint felt this week.
We have a library full of reports. I’ve been talking about these reports for a while. They are loss-control inspection reports, and they include recommendations – recommendations that we need to track. So far, I’ve told you that SharePoint can store those reports. SharePoint can manage those reports. SharePoint can read those reports and find recommendations. SharePoint can analyze the recommendations that it reads and can sort them into two piles. The first pile includes recommendations that are new, for which we need to create a stub-record of a new recommendation. The second pile is various updates to existing recommendations for which we need to create stub-records of recommendation updates. That’s cool, SharePoint can do all that. Or can it?
Well, I said it could. I told a room full of people at the AIIM Conference that it could. I told the Vice President of Engineering that it could. I told all those people it could, because I was able to do all that and create entries in those custom lists. In other words, I had seen it with my own eyes. Well, sort of. I was able to create AN entry in those lists. I was able to hit the right list with the right entry. The only thing remaining was to build out those lists with ALL the relevant details. All the relevant details include three managed metadata columns. They are present in the library of reports that SharePoint is reading, they just need to be set to the same value in the list of recommendations. How hard can that be?
That can be very hard.
That can be the kind of hard that makes you think Microsoft never wanted you to be able to use managed metadata to set managed metadata. Like Microsoft was paying for the car in that game show and never wanted that key to work. I felt like I should have taken the cereal coupons and gone home.
I checked so many blogs about this subject that I lost track of the ones that gave me hints as to how to solve this problem. Google “set managed metadata in SharePoint Designer workflow” – the relevant blogs are in the first six pages of results. In any case, thanks to everybody who ever tried this and took the time to write a blog entry because even the knowledge that others had suffered like I was suffering made me feel better yesterday. For the record:
You can set managed metadata from a SharePoint Designer workflow!
I don’t know if you can update a managed metadata column that already has value in it (fortunately I don’t have to) but you can set it if you are creating a new item. You can set it using the text version of the managed metadata which will look like:
And, according to some of the blogs I read, it might look like both of those combined.
It’s OK, either will work. You just have to get one of those strings, store it in a variable and tell SharePoint Designer to update a managed metadata item in a list with that variable and the managed metadata column will be set.
You can get that text from one of those mystery columns that you see in the list and say “that must do something.” It’s kind of like the switch in the hallway that doesn’t seem to affect any light or outlet. If my column was called “Blogs” the column with the string I need will be “Blogs_0” because, you know, adding ‘_0’ to anything means “here, this is the thing you’re looking for.”
My day got even worse, because our library has a problem. SharePoint Designer sees those _0 columns but it can’t grab the contents. So, I had to look up those values in a different list. I’m near 800 words so I’ll save that explanation for another day. It was kind of like SharePoint was saying:
“Take this key and go into the parking lot and find a car that it opens; open that car and retrieve a key from the glove compartment. That key might start this car. Or would you rather have the coupons?”