I'm using SharePoint 2010. Need to retrieve the Custom field property values using a JavaScript. [Trying to do this during item click in the SharePoint list item view. I call the JavaScript on the onClick() of a hyperlink .]
I'm using the field.get_schemaXml(); method to get the Field details.
var field = fieldCollection.getById('aa9171e5-95af-4acb-8501-fc6b2b0dd57f'); //Passing the field ID
var xmlSchemaString = field.get_schemaXml();
var domParser = getDomParser(xmlSchemaString);
var fieldElement = domParser.getElementsByTagName('Field')[0];
var fieldPropertyValue = fieldElement.getAttribute('FieldPropertyName');
function getDomParser(xmlString) {
var xmlDoc;
//IE9, Firefox, chrome, etc browser
if (window.DOMParser) {
parser = new DOMParser();
xmlDoc = parser.parseFromString(xmlString, "text/xml");
}
// Internet Explorer 8
else {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(xmlString);
}
return xmlDoc
}
I am getting the field information at the var xmlSchemaString including the field property keys and values. But when i pass the string to getDomParser() function, NULL is returned to fieldPropertyValue.
Tested in both IE and Chrome, i get the same result...null. How can I access the custom property value in the XML document?