How do I know/find the Id or name of an already open primary tab in the console?
We are building a console app where accounts are opened as primary tabs. Some of these primary tabs will be opened from a visualforce page which has a short list of relevant/related accounts and basically calls sforce.console.openPrimaryTab(). In these calls we don't specify a tab Id but we can specify a tab name (eg. the accountId) meaning any subsequent clicks on entries in the relevant/related accounts list will send the user to the correct tab as expected.
However accounts can also be opened from a standard account list. So we have no control of the tab name. What we then see is
Account X has been opened from the standard list
The user is on the tab for another related/relevant account Y
In the list of related/relevant accounts the user now clicks account X The call to sforce.console.openPrimaryTab() will fail with "openPrimaryTab: Opening a duplicate tab is not allowed."
How do we find the Id or name of this tab so we can send the user there?