3

I'm working on a custom navigation webpart for SP2013 using the JSOM.

Currently, a part of fetching the data from the termstore involves fetching all the terms and then getting data from the respective taxonomy terms:

context.load(term, ['Title', 'FriendlyUrlSegment', 'Terms', 'Parent']);
taxonomyTerm = term.getTaxonomyTerm();
context.load(taxonomyTerm);

Later on in the code I can access the data from the taxonomy term via

taxonomyTerm.get_objectData().get_properties().CustomProperties;

This brings me to two questions:

  • Is this the right way to ask for the properties I want from the taxonomy term?
  • How can I optimize the above request by specifying the fields I'm after for the taxonomy term, how can I see what options I have?
3

Since SP.Taxonomy.Term exposes CustomProperties property you could replace the line:

taxonomyTerm.get_objectData().get_properties().CustomProperties;

with this one:

taxonomyTerm.get_customProperties()

In order to optimize the request, you could specify explicitly what properties to retrieve for SP.Taxonomy.Term object via SP.ClientContext.load method, for example:

context.load(taxonomyTerm,['CustomProperties','Name']); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.