0

Hookay. So I've just about exhausted my brain trying to figure this one out on my own and I've searched around a bunch and can't seem to find anyone trying to do something similar. So I bring this one to you.

I have a solution I'm building that starts with a document library at a site collection. A project manager creates a docset which holds project documentation and, at some point, indicates on this docset that there are work area impacts. For my purposes, I decided to use a managed metadata field called Impacts (but I could use a regular multiselect or anything else, honestly).

What I want to do is have a workflow that runs when those MM terms are added that goes to an already created subsite matching the MM term and builds a document set for the work stream in a document library in the subsite. This works awesome if there's only a single impacted workstream. But multiple? Yeah, I just can't figure this out. I know this involves looping over the selections, but I can't for the life of me figure out how one would pull that MM field and count the number of entries.

Thanks, in advance, for your help.

1

You will need to parse the string value of the managed metadata field in a loop:

Next, we count the number of characters from the beginning of the string to the semicolon (I will refer to it as “DelimitIndex”) by using the “Find substring in string” action. We copy the value up to the DelimitIndex by using the “Copy from string, starting at 0 for 0 characters” action. At this point, we will have the first selected value “TX | c61d9028-824f-446e-9389-eb9515813a42”

Now, using the same actions, I find the number of characters (Index) to the pipe (|) and copy the value up to “Index”. This grabs the value that we really care for “TX”

I trim the current value, just in case there are some extra spaces and get “TX” as the end result. Next step is to add the current value to a compounding variable “District” ([%Variable: District%][%Variable: CurrentVal%]; – note the I add a semicolon at the end to delimit the values. Any other delimiter can be used).

I have cleaned my first selected value, I have to tell the loop it is time to move to the next selected value. I add 1 to DelimitIndex. This will tell me where the next selected value starts. I remove the first value out of my initial “TempVar” variable by copying ONLY everything after the semicolon (i.e. The second selected value). Now we just let the loop repeat the same clean up routine. Once the loop is completed District would like “TX;CA;”

https://ramirezmery.wordpress.com/2015/03/01/parsing-managed-metadata-columns-in-a-sharepoint-designer-2013-workflow/

  • 1
    Ha! I should have just waited to do the same googling I'd been doing on my work computer on a home computer. That result from Mery Ramirez pops up but wordpress is blocked at my company and I'd since just edited it out of my mind. Thanks! – ChrisPEditor Mar 12 '16 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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