0

I am doing a sforce.console.openPrimaryTab() and want to open a Case, in a new console tab, once it has been clicked on. So far I have:

VFP

<apex:pageBlockTable value="{!caseOnCase}" var="item">
    <apex:column headerValue="Merchant Number"><apex:outputLink value="{!URLFOR($Action.Case.View, item.Id)}" onclick="testOpenPrimaryTab(); return false">{!item.Merchant_Number__c}</apex:outputLink></apex:column>

JS

function testOpenPrimaryTab() {
    sforce.console.openPrimaryTab(null, '/' + '{!currentPageId}' + '/d?retURL=https%3Z%2Z%2Zz.cs66.visual.force.com%2Zapex%2ZcasesOnCase%3Qinline%3J9%26id%3H500c065477ytest&_CONFIRMATIONTOKEN=' + '{!CONFIRMATIONTOKEN}' + '&common.udd.actions.ActionsUtilORIG_URI=%2R' + '{!currentPageId}' + '%2test', true, 'salesforce', 'salesforceTab');
}

Everything is working other then the Confirmation Token Part of the URL. {!CONFIRMATIONTOKEN} How would I find the confirmation token and save it into a variable, to be called in this url string?

UPDATE:

On a Case page layout I have an embedded visualforce page. The visualforce page is a list of all related Cases. The apex:column {item.Merchant_Number__c} is a link to the related Case. When I click on the link, I need the related Case to open in a console tab. When I change the apex:column to: <apex:column target="_blank">{!item.Merchant_Number__c}</apex:column> the Case can be opened in a new browser tab. This browser tab's URL is the URL I am trying to use with the sforce.console.openPrimaryTab(). I assume there is some flaw with using the browser URL as my URL for the primary tab function.

CONFIRMATIONTOKEN is just a placeholder for where I need to fill in the confirmation token.

Partial Resolution: I found the token by doing:

CONFIRMATIONTOKEN = ApexPages.currentPage().getParameters().get('CONFIRMATIONTOKEN');

and passed the token into the string on the VFP. My concern is that this is registering as a duplicate tab. So Salesforce is not allowing me to open it. The error I am getting is: openPrimaryTab: Opening a duplicate tab is not allowed.

  • Did you copy this code from somewhere? – Adrian Larson Mar 28 '17 at 23:40
  • Do you want to find out CONFIRMATIONTOKEN, which is being passed as parameter during opening concord tab? Secondly, it the calling visualforce page is in console? Thirdly, are you trying to open the same visualforce page in other console tab? Please edit your question and provide more details – Santanu Boral Mar 29 '17 at 0:52
  • @AdrianLarson I wrote this but copied the URL in openPrimaryTab() from my browser. It is the URL from when I open a Case in a browser tab. – Olivia Mar 29 '17 at 14:38
  • @SantanuBoral I want to find out how to find the CONFIRMATIONTOKEN. This was just a placeholder. I know I need to put in a confirmation token there but I am not sure how to find the token. Or if I even can find the token. It is calling the visualforce page in the console. I am trying to open a Case in a new console tab. I have update my question and will add pictures. – Olivia Mar 29 '17 at 14:41
0

Looks like I was way over complicating it. All I needed was the page id. It should look like this:

sforce.console.openPrimaryTab(null, '/' + '{!pageId}', true, 'salesforce', openSuccess, 'salesforceTab');

or

sforce.console.openPrimaryTab(null, '/409b0111009yc7pYTE', true, 'salesforce', openSuccess, 'salesforceTab');
| improve this answer | |

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.