1

I am trying to build a link in an external, which when clicked, would open up a contact detail view in the Console Layout. This URL need to be dynamically generated based on phone number - nothing else. When clicked, it would open up Salesforce Console with matching contact record opened as a tab.

How do I approach this one?

2

You can direct a user to a console link that will open a specific record as a primary tab with a URL like this

http://yoursalesforceurl/console#%2F003xx0000012345

You would need to already know the contact ID though. If you are building an external link with only a phone number, you could point that link to a page with an apex controller that looks up the contact and then redirects the user. That path might look something like this:

User clicks a link to http://yoursalesforceurl/console#%2Fapex%2FgotoContact?phone=1234567890

The page named gotoContact is something like this

<apex:page controller="myController" action="{!redirect}"></apex:page>

The apex class myController has a method that looks like this

public PageReference redirect() { 
    String phone = ApexPages.currentPage().getParameters().get('phone');
    String contactId = [SELECT Id FROM Contact WHERE Phone:=phone][0];
    PageReference pr = new PageReference('yoursalesforceurl/console#%2F'+contactId);
    return pr; 
}

See also:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_system_pagereference.htm

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm

VF controller redirect to another page

  • Hi, Also what would I append to navigate to console in edit mode of the case record ? – Kiba Aug 9 '18 at 12:38
  • @Kiba You can use /e to get to an edit page, so something like yoursalesforceurl/console#%2F003xx0000012345%2Fe to get to the edit page of that record – Paul H. Aug 10 '18 at 22:23

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.