For building a CAML query including filters by Managed Metadata Column, I need to get the wssid for terms I've only the unique ID.
I found a lot of examples using C# and Microsoft.SharePoint.Taxonomy.TaxonomyField.GetWssIdsOfTerm, but now example using the JavaScript Object Model.
Is this even possible with JavaScript?
Example
var ctx = SP.ClientContext.get_current();
var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(ctx);
var termStores = taxSession.get_termStores();
var termStore = termStores.getByName('My Termstore');
var currentTermSet = termStore.getTermSet('f71f5e3f-d393-4ad8-a648-b6ca20f2ce75');
ctx.load(currentTermSet);
ctx.executeQueryAsync(
function () {
var terms = currentTermSet.get_terms();
ctx.load(terms);
ctx.executeQueryAsync(
function () {
var termsEnum = terms.getEnumerator();
while (termsEnum.moveNext()) {
var currentTerm = termsEnum.get_current();
var termUniqueID = currentTerm.get_id();
var termLabel = currentTerm.get_name();
// How to get the wssid which is needed for filtering in CAML?
}
});
});