I have the following JavaScript code which must load a TermSet from SharePoint managed metadata store. The code was working fine until Monday and suddenly stopped working with the error on the title.

I changed the contents of the executequeryasync with just a console.log and I still have the error.

I already debugged line by line the execGetTermIds, and none of the lines there throw the exception

function GetTermsDataFromTaxonomy(){
    //Current Context
    var context = SP.ClientContext.get_current();           
    //Current Taxonomy Session
    var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);           
    //Term Stores
    var termStores = taxSession.get_termStores();           
    //Name of the Term Store from which to get the Terms.
    var termStore = termStores.getByName("Taxonomy_kl5tZjInn7STsFTzIE7n3Q==");          
    //GUID of Term Set from which to get the Terms.
    var termSet = termStore.getTermSet("31da4bc1-6429-499a-9d5e-be5e18b13c87");         
    var terms = termSet.getAllTerms();      
    var list;   
    var p = execGetTermIDs();
    p.done(function(result) {


    p.fail(function(result) {
        // result is a string because that is what we passed to reject()!
        var error = result;


function sortTermsFromTree (tree) {
    if (tree.children.length && tree.term.get_customSortOrder) {
        var sortOrder = null;

        if (tree.term.get_customSortOrder()) {
            sortOrder = tree.term.get_customSortOrder();

        // If not null, the custom sort order is a string of GUIDs, delimited by a :
        if (sortOrder) {
            sortOrder = sortOrder.split(':');

            tree.children.sort(function (a, b) {
                var indexA = sortOrder.indexOf(a.guid);
                var indexB = sortOrder.indexOf(b.guid);

                if (indexA > indexB) {
                    return 1;
                } else if (indexA < indexB) {
                    return -1;

                return 0;
        // If null, terms are just sorted alphabetically
        else {
            tree.children.sort(function (a, b) {
                if (a.title > b.title) {
                    return 1;
                } else if (a.title < b.title) {
                    return -1;

                return 0;

    for (var i = 0; i < tree.children.length; i++) {
        tree.children[i] = sortTermsFromTree(tree.children[i]);

    return tree;

function execGetTermIDs(){
    var d = $.Deferred();
    var q = "<View><Query><Where></Where></Query></View>";
    var context = new SP.ClientContext(siteUrl);
    var oList = context.get_web().get_lists().getByTitle('TaxonomyHiddenList');
    var camlQuery = SP.CamlQuery.createAllItemsQuery();
    var collTermListItem = oList.getItems(camlQuery);
    var o = {d: d, collTermListItem:collTermListItem};
    Function.createDelegate(o, getTermIDsComplete),
    Function.createDelegate(o, failCallback)
    return d.promise();

function getTermIDsComplete()
    var listItemEnumerator = this.collTermListItem.getEnumerator();
    while (listItemEnumerator.moveNext()) {
        var oListItem = listItemEnumerator.get_current();
        termIDs[oListItem.get_fieldValues().Title] = oListItem.get_id();

function failCallback() {
    this.d.reject("something bad happened");

1 Answer 1


omg, I found the error, and I cant find an explanation on this, hopefully somebody at Microsoft can tell me.

this line: var termStore = termStores.getByName("Taxonomy_kl5tZjInn7STsFTzIE7n3Q==");

We noticed the name is now different, it has a different guid, but we as customers cant change that name, so the only reason is Microsoft changed it for us because it was working on monday.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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