+ Start a Discussion
Matthew CallisonMatthew Callison 

Refresh a tab from another tab

I'm new to Salesforce, so forgive me if I get the terminology wrong, but I'll try to explain this as detailed as possible.

On our agents' workspace, when they have a Case open, there is a Tab Lightning component that has Details, Email, Knowledge, etc.  On one of the tabs, we have an IFRAME with a page that has order details.  When the agents change information on this page, they have an "Update Case" that writes the changes.  Everything works great there.

The issue that I am trying to address is that the "Details" tab is not refreshing with the new data, so when the agent (for example) updates an invoice number and switches to the "Details" tab, the 'Invoice Number' field is not updated.  Of course, closing the case and re-opening displays the correct data, since the write to the object works.

What I would like to do is have that "Update Case" button refresh that OTHER tab, as well as the tab the component is on.  I already have:


...and that works for the tab that the button is on.  Is there a way to pass that refresh command to another sub-tab in the Tabs component?

Glyn Anderson (Slalom)Glyn Anderson (Slalom)

Matthew, It sounds like your agents are using the Lightning Console UI in Salesforce.  Given that the "Update Case" button is in an IFRAME, it will not be able to affect any other tabs - or anything outside of the IFRAME.  This is enforced by Lightning (Locker Service) and all modern browsers, to prevent cross-site security issues.  That said, I don't see any way to automatically refresh the tab (although other respondents might do better).  There are easier ways to refresh the tab manually than closing and reopening the Case (or refreshing the whole browser page), though.  You can click "Refresh Tab" in the tab menu:

User-added image

Or you can use the Lightning Console keyboard shortcut, "Shift + R".

For customizations that aren't in an IFRAME you can use the Lightning Console JavaScript API: https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_js_getting_started.htm to open/close tabs, give/take focus, refresh tabs, etc.

Glyn Anderson (Slalom)Glyn Anderson (Slalom)
And if I've misunderstood -- and the "Update Case" button isn't in the IFRAME with the rest of it, then look at the Lightning Console JavaScript API.  That'll do the trick...
Matthew CallisonMatthew Callison
You have understood correctly.  Our agents are using the Lightning Console UI.  And yes, the "Update Case" button is inside of the IFRAME.

Let's say the IFRAME is on Tab A, and the Case Details tab is Tab B.  I have been able to get a Lightning Component Controller/Helper function on Tab A to fire when the "Update Case" button in the IFRAME is clicked.  I know that I probably cannot get a Lightning Component on Tab A to just refresh Tab B, but I am wondering if a Lightning Component on Tab A can talk to a Lightning Component on Tab B, and then the component on Tab B can refresh Tab B?