locked
How to get the Term URL from Taxonomy SharePoint RRS feed

  • Question

  • Hi ,

    I am using the below code and able to get all terms .

    My requirement is to get the corresponding URL of the term .when I use the below line it is giving undefined .

    var nodeTitle = spTerm.get_localCustomProperties()["_Sys_Nav_Title"];

    function execOperation() {

        var termSetName = "Termset name";
        var locale = 1033;
        clientContext = SP.ClientContext.get_current();
        taxonomySession = SP.Taxonomy.TaxonomySession.getTaxonomySession(clientContext);
        var termStore = taxonomySession.getDefaultKeywordsTermStore();
        var termSets = termStore.getTermSetsByName(termSetName, locale);
        var termSet = termSets.getByName(termSetName);
        var terms = termSet.getAllTerms();
        clientContext.load(taxonomySession);
        clientContext.load(termStore);
        clientContext.load(termSet);
        clientContext.load(terms);
        clientContext.executeQueryAsync(function onSuccess() {
            var chaparray = [];
            var enumerator = terms.getEnumerator();
            while (enumerator.moveNext()) {
                var spTerm = enumerator.get_current();
                var spTermname = spTerm.get_name();
            
                    var nodeTitle = spTerm.get_localCustomProperties()["_Sys_Nav_Title"];   // I am getting undefined
                    chaparray.push(nodeTitle);
             
            }
        },
    function onFailure() {
        console.log("error in termstore");
    });
    }

    Wednesday, July 5, 2017 6:27 PM