You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to read Menu Custom Field values from Javascript API?

Accepted answer
42
Views
1
Comments
edited Jun 8, 2022 12:05PM in General Technical Discussions 1 comment

Content

Hi All,

I have tried reading Menu type Custom Field values. But I am getting an undefined error. I am using following code block:

Version

Nov 2014

Code Snippet

             <script type="text/javascript">
function onbeforesave()
{
	var inc = window.external.Incident;
	var Prov = "";
	var ProvId = inc.GetCustomFieldByName("c$test_menu_field");
	alert("Provider ID : " +ProvId);
	var ProvLbls = inc.GetNameValues("c$test_menu_field");
	alert("Provider labels : " +ProvLbls);
	xmlDoc.loadXML(ProvLbls);
	var x = xmlDoc.getElementsByTagName("Item");
	for (i = 0; i < x.length; i++) 
	{
		var attlist=x.item(i).attributes;
		var att=attlist.getNamedItem("Id");
		if (att.value==ProvId) 
		{
			Prov = attlist.getNamedItem("Name").value;
		}
	}
}
</script> 
        

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!