How can I use managed metadata in workflows in Office 365? I have a single action to email a value of the MMD field and the workflow gives me the following error:
RequestorId: 66fb4a47-8127-29f3-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.InvalidCastException: The value 'd/results(0)/Field' 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) Exception from activity GetDynamicValueProperty<String> Sequence DynamicActivity<String> ToString FormatString NintexActivities.WorkflowXaml_8e03d64c_49b1_4845_a435_94f748f07d04 Sequence Flowchart WF - Workflow Name.WorkflowXaml_cfd57983_c02f_4801_aafb_dce6bd969580
If it is not a string what is it and how to send it an email or use as a variable?
Solved! Go to Solution.
I gave this a shot and found a workaround, as I think this may be a bug.
In your Item Properties list, you should see an option for a very closely named Item Property, such as the Managed Metadata source you are trying to pull from. In my example, I have a source called 'Office', and another called 'Office_0'.
If I use 'Office', I will receive the same error as you, but if I use 'Office_0', the workflow will execute correctly.
However, instead of the value 'Dubai' being returned, I will get the following:
So, if I use an extra action such as RegEx to remove all characters after the |, I will be able to store the output in a new collection variable, in this case 'colMMDOutput':
Next, use the 'Get Item from Collection' action to get the value at index 0, and store it in the string or text variable 'txtMMDOutput':
The new variable will be able to sent within the email:
Hello - In my case managed metadata contains both alpha and numeric characters but the following RegEx solved the issue:
Also I didn't have to use the Collection Variable. Thanks for your help!