var refreshSubtab = function refreshSubtab(result) {
    var tabId = result.id;
    sforce.console.refreshPrimaryTabById(tabId, true);

I am using above code to refresh the tab by its id. When loading this page in salesforce console, it refreshes the whole page.

When move to lightning, it does not refresh at all. sforce is not defined in lightning.

Is there anything I am missing?

1 Answer 1


sforce.console only works in the classic console. The Lightning Console API is not GA yet. You can see information about the pilot here: https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_js_getting_started.htm.

Look at this question, it talks about how to use force:refreshView Reload whole page in 'lightning' using java script

  • Thanks. It looks good. I want to refresh the primarytab after oncomplete(). Its working in the visualforce page. Not in lightning. Is there any workaround or implementation to make the page reload? Commented Jun 16, 2017 at 16:13
  • You could just use location.reload(); Commented Jun 16, 2017 at 16:23
  • Or you could maybe fire a refreshView event - developer.salesforce.com/docs/atlas.en-us.lightning.meta/… Commented Jun 18, 2017 at 8:28
  • @MattGoldspink How can I add refreshview event? I cannot pass this $A to any of my events. Do I need to include $A as a namespace or a javascript file? Please guide me on this. Commented Jun 19, 2017 at 8:33
  • location.reload() is reloading only the iframe content which is loaded in the right side panel. So, I tried using parent.location.reload(), Its not also refreshing the page. Any clues? Commented Jun 19, 2017 at 8:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .