Previously, I was retrieving the Managed Metadata Field Value in display format. I encountered an issue when attempting to use this value to update a form field on a modal popup however, due to multiple results in the Term Store being found for a single string. To remedy this, I found the hidden value for the Metadata Field including the GUID of the term. To do this, I used my handy Powershell script from my previous post, and located the field name for the Metadata Field. I then located the following XML for my field:
<Field Type="Note" DisplayName="Role_1" StaticName="RoleTaxHTField" Name="RoleTaxHTField" ID="{bbaf434e-cc7e-40b5-b43e-5605ee3c3543}" ShowInViewForms="FALSE" Required="FALSE" Hidden="TRUE" CanToggleHidden="TRUE" SourceID="{d96d858a-03f7-4b0f-a73f-fc0ee68996cd}" Customization="" ColName="ntext9" RowOrdinal="0"/>
<Field Type="TaxonomyFieldTypeMulti" DisplayName="Role" List="{aff9fc9f-40b8-4a89-aaa3-f5f566117446}" WebId="d96d858a-03f7-4b0f-a73f-fc0ee68996cd" ShowField="Term1033" Mult="TRUE" Sortable="FALSE" Required="FALSE" Group="Knowledge Base Columns" ID="{5050205f-5771-40e1-b356-ec6c989147f1}" SourceID="{d96d858a-03f7-4b0f-a73f-fc0ee68996cd}" StaticName="Role" Name="Role" Version="4" EnforceUniqueValues="FALSE" Customization="" ColName="int8" RowOrdinal="0">
<Default/>
<Customization>
<ArrayOfProperty>
<Property>
<Name>SspIdName>
<Value xmlns:q1="http://www.w3.org/2001/XMLSchema" p4:type="q1:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">d6d8e56a-06c9-4c99-a5b0-1ea8b6eb747fValue>
Property>
<Property>
<Name>GroupIdName>
Property>
<Property>
<Name>TermSetIdName>
<Value xmlns:q2="http://www.w3.org/2001/XMLSchema" p4:type="q2:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">50857e97-8bdf-4000-bf13-5b1ba34d745aValue>
Property>
<Property>
<Name>AnchorIdName>
<Value xmlns:q3="http://www.w3.org/2001/XMLSchema" p4:type="q3:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">00000000-0000-0000-0000-000000000000Value>
Property>
<Property>
<Name>UserCreatedName>
<Value xmlns:q4="http://www.w3.org/2001/XMLSchema" p4:type="q4:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">falseValue>
Property>
<Property>
<Name>OpenName>
<Value xmlns:q5="http://www.w3.org/2001/XMLSchema" p4:type="q5:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">falseValue>
Property>
<Property>
<Name>TextFieldName>
<Value xmlns:q6="http://www.w3.org/2001/XMLSchema" p4:type="q6:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">{bbaf434e-cc7e-40b5-b43e-5605ee3c3543}Value>
Property>
<Property>
<Name>IsPathRenderedName>
<Value xmlns:q7="http://www.w3.org/2001/XMLSchema" p4:type="q7:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">falseValue>
Property>
<Property>
<Name>IsKeywordName>
<Value xmlns:q8="http://www.w3.org/2001/XMLSchema" p4:type="q8:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">falseValue>
Property>
<Property>
<Name>TargetTemplateName>
Property>
<Property>
<Name>CreateValuesInEditFormName>
<Value xmlns:q9="http://www.w3.org/2001/XMLSchema" p4:type="q9:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">falseValue>
Property>
<Property>
<Name>FilterAssemblyStrongNameName>
<Value xmlns:q10="http://www.w3.org/2001/XMLSchema" p4:type="q10:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429cValue>
Property>
<Property>
<Name>FilterClassNameName>
<Value xmlns:q11="http://www.w3.org/2001/XMLSchema" p4:type="q11:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue>
Property>
<Property>
<Name>FilterMethodNameName>
<Value xmlns:q12="http://www.w3.org/2001/XMLSchema" p4:type="q12:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">GetFilteringHtmlValue>
Property>
<Property>
<Name>FilterJavascriptPropertyName>
<Value xmlns:q13="http://www.w3.org/2001/XMLSchema" p4:type="q13:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">FilteringJavascriptValue>
Property>
ArrayOfProperty>
Customization>
Field>
As you can see, there are 2 fields listed in the XML. The first field is the hidden value including the GUID of the term or terms, and the second field is the container/display field that is rendered as a string in Display Mode.
On my display form for the items that will be receiving feedback, I added a hidden field in the XSLT, and set the value to
<xsl-value-of select="@RoleTaxHTField" />
When opening the dialog, the arguments passed include the value of this field. On my dialog I now set the following the hidden storage field of the Metadata Field to the value passed. Now when the user submits the feedback, the value is mapped to the correct term without any errors, and there is no need to run the javascript that forces the metadata field to update.
I liked your article, I will share your article to everyone!!
ReplyDelete________________________________________________________________________
WoW gold|Diablo 3 Gold|RS Gold|GW2 Gold