Pulling Managed metadata from a list field

Copper Contributor

Hey - hope someone can help with this before i lose all my hair!  I have a sharepoint list in a top level team site in o365.  In a subsite i have a javascript which pulls a row from the list in the parent site and displays the information on a page - everything works fine!  I then have a same setup on the subsite - the site has a list and the site below that then pulls from the parent site's list and displays on the page.  However, on this site the fields which are management metadata are not working, giving the error:

 

Object doesn't support property or method 'get_label'

 

The oddest thing is that the same managed meta field is used in both lists and the javascripts work identically!  the offending line is:

 

oListItem.get_item('RAG').get_label()

 

Any idea at all what could be going wrong - like i say I have the same code in both scripts and the same managed metadata is used in both lists!

 

Thanks in advance!

3 Replies

It looks like your oListItem.get_item('RAG') is failing. Is your RAG field a list column or a site column?

 

If you are using list columns check the internal names (list settings -> column -> check url)

 

yes that is the line thats failing.  The name is correct - as i say, exactly the same code to the same managed metadata on another list works perfectly

I have made a new discovery.  The script that pulls the information is stored at site collection level.  If the script is used at the 1st level subsite it works perfectly.  If the same script is used at 2nd level subsite its works for all values of the list except any that are managed metadata.

 

It would appear that accessing managed metadata from a sub subsite isnt working with my code - any idea what this would be or how to rectify it?