0

Callback function is not executing in console tab method closeTab, but the id provided to the method IS closing.

Why?

    function callback (result) {
       console.log('in callback');
           }


    function returnOpenPrimary(openPrimary) {
        var listOfTabIds = openPrimary.ids;
        console.log(listOfTabIds);
           for (let i=0;i<listOfTabIds.length;i++) {

            sforce.console.getPageInfo(listOfTabIds[i] , function showPageInfo (pageInfoResult) {
            var response = JSON.stringify(pageInfoResult.pageInfo);
            console.log(i);
            console.log(listOfTabIds[i]);
            console.log(response);
            var stringCheck = response.includes("powerCrystal");
            if (stringCheck == true) {
                console.log('string check is true');
                console.log(listOfTabIds[i]);
                sforce.console.closeTab(listOfTabIds[i], callback);
                }
            })  
          }
        }

Your Answer

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

Browse other questions tagged or ask your own question.