I've noticed an issue that seems to be specific to the service console user interface.

I have a VF email template on the case object. Included on this email template is a link to the case record, which I achieve using the following code from this thread.

<apex:variable var="url" value="{!LEFT($Api.Partner_Server_URL_140, FIND(".com/",$Api.Partner_Server_URL_140)+3)}"/>
<apex:outputLink value="{!url}/{!relatedTo.Id}">Case Link</apex:outputLink>

I've tied this VF email template to an email alert triggered by a case workflow rule. Those work correctly regardless of UI used.

However, the 'Case Link' generated from the template seems to be different in the resulting email, depending on whether you were using the regular SF UI or the Service Console UI.

When I make the necessary changes to a case to trigger an email alert within the standard UI, the case link generated from the template works fine. The actual URL behind the 'Case Link' text in the email is


But when I make the same changes on the same case in the Service Console, the URL looks like this:


Which throws security errors with most email clients and prevents it from opening (client security probably blocks the javascript).

Seems like this is directly related to how URLs to console viewed records differ from the standard. My question is, how can I provide a link to my case record that works in both the console view and the standard UI, and can be accessed by both internal users and Customer Community users?

(Edited for additional info)


Don't use apex:outputLink, but create a hardcoded link like this

<a href="{!url}/{!relatedTo.Id}">Case Link</a>

You're only using this VF for the email template, right? Then this should work. If you need a link that opens a tab in the console if available, but opens the normal way otherwise, you'd have to go like this:

<a href="{!url}/{!relatedTo.Id}" onclick="return (function() { if(srcUp) { srcUp('{!url}/{!relatedTo.Id}&isdtp=vw'); return false; } })()">Case Link</a>

Basically, on click, it runs some Javascript that checks if the srcUp function exists, and if so, uses it to open a new tab and returns false to prevent the normal click behaviour. I have not tested this but it should work...!

The isdtp=vw parameter that we add to the URL is used in the Service Console to indicate that the page should be rendered without the tabs and sidebar.

Edit: if you want to make this re-useable, you could create a component like this:

    <apex:attribute name="link" type="String" description="Where to link to" required="true"></apex:attribute>
    <apex:attribute name="text" type="String" description="The text to display in the link" required="true"></apex:attribute>
    <a href="{!link}" onclick="return (function() { if(srcUp) { srcUp('{!link}&isdtp=vw'); return false; } })()">{!text}</a>
| improve this answer | |
  • Yup, it works, thanks! Bounty is yours. 'Bonus' question: with your method, the link now works, but takes me to a standard UI view of the case in both scenarios - is there a way to create a link that opens the record in the console UI? – smohyee Mar 17 '16 at 21:29
  • 1
    Ah, I was waiting for that question ;-) Yes, you can do that. I've added it to the answer! Thanks. – Willem Mulder Mar 18 '16 at 7:03
  • 1
    Oh, you're good. You're very good. – smohyee Mar 24 '16 at 15:06

Do you have access to this Trigger? If so, could you provide a snippet of the code which sends the email after grabbing, and setting the template, please?

| improve this answer | |
  • Hi James. There isn't a trigger involved. Rather, I'm using workflows and email alerts with visualforce email templates. The code snippet I posted was from the VF template. I could post more if you like. – smohyee Mar 17 '16 at 20:17
  • And just to clarify the situation: the workflows are working fine, both when in the console UI and the regular UI. I'm getting the proper emails in both cases, the only difference is the 'Case Link' part of my email. – smohyee Mar 17 '16 at 20:19

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.