4

This is an expected behaviour since postMessage with targetOrigin '*' sends the message with no target preference and your tabs are in the same lightning container. The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded ...


3

www.salesforce.com has the header X-Frame-Options: SAMEORIGIN. An origin is defined as the specific subdomain that exactly matches the origin. So, for example, in your sandbox, your origin is cs14.salesforce.com, while the domain for Salesforce is www.salesforce.com, and since cs14.salesforce.com == www.salesforce.com is false, the request for framing is ...


3

The sforce.console.getEnclosingTabId method is asynchronous and the method you pass in as a parameter is termed a callback function. This behavior is clearly indicated in the documentation: This method is asynchronous, so it returns its response in an object in a callback method. Due to the above, your subtabId is still empty (''), so your call to ...


3

The tab IDs are unique within a console, but not guaranteed to be the same if you close and reopen a tab or if you leave and re-enter the console. So you may have primary 'scc-pt-0' with a subtab 'scc-st-0' and 'scc-st-1'. If you close that primary tab then reopen it then it's possible it will now be 'scc-pt-1'. But if you leave the primary tab open it will ...


2

It sounds like what you're getting is the ID of the tab when what you really want is the ID of the object. For this you can use sforce.console.getFocusedPrimaryTabObjectId instead of sforce.console.getFocusedPrimaryTabId. Note that you'll probably want to also setup a listener on one or both of sforce.console.onFocusedPrimaryTab and sforce.console....


2

You are likely to still have the same Cross Domain scripting issue as custom console components (Visualforce) are served from a different domain. The Salesforce Best Practice would be to override the page with a complete Visualforce Page, depending on what type of "alteration" you are trying to accomplish.


2

Did you change your signature of openPrimaryTab to take parameters and verify that {!URLFOR($Action.Account.View, Case.Account.Id )} evaluates to a legal URL? The following code works successfully for me. <apex:page> <script src="/support/console/37.0/integration.js" type="text/javascript"></script> <script> function openPrimaryTab(...


2

I found the following reference in Launching a Visual Force Page in the Service Cloud Console (my emphasis): IMPORTANT: Be careful if your uses a visualforce inside another vf, for example using . The services console has one level of indirection between domains, so if you try to use console toolkit inside the iframe, you will get a javascript error ...


2

If you are opening the standard record from listview in console then page will be in console. It works perfectly based on your code. Issue is: Your development mode is opened. Close the development mode option and it will work perfectly.


1

You're right about the console integration methods not working because they're being called from inside an iFrame. Is there any reason the button needs to be in a visualforce page embedded in the record detail page? If you could use a plain o'l js custom button, you could make it work using something like this: {!REQUIRESCRIPT("/support/console/44.0/...


1

There is a Lightning Console JavaScript API for Lightning Experience in Pilot right now, I think it will be the way to go once it's GA.


1

If you use javascript button, throw the error using alert like this: alert ('There is no Activity record associated with this Fax. Please contact your System Administrator'); It should stay on the same page. Note: throw new Error() works best in apex classes.


1

I used a workaround suggested in SFDC Developer Forum by Ron Wild.


1

To recognize whether the page is in console or classic view (non-console) change the formula field like this: Formula field to open visualforce in console HYPERLINK("javascript:if(typeof(srcUp)=='function') {srcSelf('/apex/Sitepage?id=" & Id & "');} "+ " else {window.location.href='/" & Id & "'}" ,Name , "_Parent" ) The typeof(srcUp)=...


1

What your screenshot shows is indeed a primary tab 'Mario Rossi'. But what you don't see is that there is actually a 'Details' subtab contained within that primary tab. Were you to open additional subtabs you would then see the 'Details' subtab shown like this: My assumption is you're using a method like getEnclosingTabId() to get the tab ID before passing ...


1

You want getFocusedSubtabObjectId. sforce.console.getFocusedSubtabObjectId(new function (result) { console.log(resul.objectId); } On a side note, why reinvent the wheel? Just grab the caseId from your controller. public with sharing class MyExtension { public Id caseId { get; private set; } public MyExtension(ApexPages.StandardController ...


1

Posting comment as answer Provide a callback function and use setTimeout(function(){ alert("Hello"); }, 5000); Obviously replacing the alert with the code you need?


1

The events that are fired in the console are asynchronous events, similar to callouts to other web services. When you do something that refreshes the page (such as setting location=...) this triggers a Javascript unload() event. By design, when a browser is unloading a page it does a whole bunch of stuff, including dropping any asynchronous events it had ...


1

Uou can use openSubtab() method, which creates as well as overrides subtab. sforce.console.openSubtab(primaryTabId , 'http://www.salesforce.com', false, 'salesforce', null, openSuccess, 'salesforceSubtab'); Opens a new subtab (within a primary tab) that displays the content of a specified URL, which can be relative or absolute. You can also override ...


Only top voted, non community-wiki answers of a minimum length are eligible