2

I am trying to create one custom button which works in both console app and normal salesforce tabs using onclick javascript.

I'm facing an issue 'Registry is null or undefined' in console app.

My code looks similar to this

{!REQUIRESCRIPT("/support/console/28.0/integration.js")}
var redirectUrl = '/{!Case.AccountId}';
if (sforce.console.isInConsole()) {
        sforce.console.getEnclosingPrimaryTabId(function(primaryResult){
            sforce.console.openSubtab(primaryResult.id, redirectUrl, true, '', null);
        });
}
else {
    window.location.href = redirectUrl;
}

If I add this line: {!REQUIRESCRIPT("/xdomain/xdomain.js")}, then the 'Registry is null or undefined' error doesn't appear but the tab is not opening.

Please help.

1

The redirect URL is different in and outside of the Console. Define the redirect URL as {! URLFOR($Action.Account.View, Case.AccountId) } or similar, depending on your context.

I hope that helps.

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.