3

I have came across an issue that I am unable to solve in the Console: I have a formula field which holds a clickable icon which should be used to indicate that a change has occured to the Object. When a User clicks this a return URL are returned by the VF's Controller, which does some logic (but should mainly set the field controlling the visibility of the Formula field to false). It should be available from both the Queue (list view) and inside the layout for the Object. From the Queue it works, it opens the Case and removes the icon. But inside the Object I cannot get it to work, it gives the error: "openPrimaryTab: Opening a duplicate tab is not allowed.". I do not know what I am doing wrong here or what I need to do to solve it, any ideas?

var j$ = jQuery.noConflict();

    j$(document).ready(function(){

        openPrimary();

    });

    function openPrimary(){
        var id = '{!$CurrentPage.parameters.id}';
        var origin = '{!$CurrentPage.parameters.origin}';
        var consoleCheck = '{!$CurrentPage.parameters.isdtp}';

        Visualforce.remoting.Manager.invokeAction(
            '{!$RemoteAction.FormulaController.checkCaseNotificationStatus}', id, origin, consoleCheck, handleResult);

    };

    var handleResult = function handleResult(result, event){

        var idCase = result[0];
        var caseNumber = result[1];
        var url = result[2];

        try{
            sforce.console.openPrimaryTab(null, url, true, caseNumber, openSuccess);
            console.log('primary opened');
        }catch(err){
            console.log('Error Caught: ' + err);
            window.location.reload();
        }
        sforce.console.refreshNavigationTab();
    };

    var openSuccess = function openSuccess(result){
        if (result.success == true) {

        } else {
            console.log('Error Caught: ' + result);

        }
    }

Ciao!

1

Recently I was getting the same error, when i was trying to open case in primary tab. For me it was happening, because under setup the console application was configured to open case in subtab and I was trying to open case in primary tab. Later when i updated backend console app to open case in primary tab, it started to work as expected.

Please check if that is the problem in your case.

  • Thanks for your reply, that is not the issue in my case. In my App the Cases are opening in Primary Tabs. – erikduvet Jan 14 '16 at 21:55

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.