Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have a workflow which gets fired by a customer portal user and this in turns fires email alert notifying system admin user. I have created an email template for this. In which I use {!CustomObj__c.Link} to show record link so that system admin user can directly jump to detail page. But in the final email that is delivered to system admin, this link contains customer portal name i.e. https://idmaxi-1361.cloudforce.com/inventorportal/a0ab0000000PpiC But I want it to be https://na9.salesforce.com/a0ab0000000PpiC.

What could be the reason?

share|improve this question
    
It would be really helpful to forward this to Salesforce support. Links in emails seem to be causing a lot of issues (sometimes visualforce domain, sometimes regulard domain, sometimes portal domain) these days and it would help if they knew about it –  Ralph Feb 22 '13 at 16:23

1 Answer 1

I've used the following formula in Visualforce email templates to generate the server instance for a link:

Left($Api.Enterprise_Server_URL_190,(find('/services',$Api.Enterprise_Server_URL_190)))

Then I just concatenate the record id to this

Note: this was for eu server instances, though I can't see why the NA etc would cause a problem.

If this can't be used, due to an HTML template for example, you can create a custom formula field on the sobject, called Record Link or similar, as follows:

HYPERLINK(Left($Api.Enterprise_Server_URL_190,(find('/services',$Api.Enterprise_Server_URL_190))) + Id, 'Record Link' )

and then use that in the template.

If this is still pulling the custom web address, you may need to revert to the clunky mechanism of storing the server URL in a custom setting and use that in the email template. The downside to this is that whenever you refresh a sandbox (for example) you'll need to fill in the custom setting anew.

So if I have a custom setting named 'URLS' and this has a field of 'Server__c', I can use this in the template as something like:

Direct Link: {!$Setup.URLS__c.Server__c + '/' + id}
share|improve this answer
    
As of now, I am having html template only not a visualforce template. I guess it will not work on that? –  doga Feb 22 '13 at 10:11
    
I've updated the answer with an option that should work for HTML templates). –  Bob Buzzard Feb 22 '13 at 10:35
    
I created a formula field that doesn't work too. It also generates url like idmaxi-1361.cloudforce.com/inventorportal/a0ab0000000PpiC –  doga Feb 26 '13 at 6:34
    
Hmm. Clearly the custom URL sticks for the entire transaction. I've updated the answer with the old, clunky way of doing things. –  Bob Buzzard Feb 26 '13 at 8:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.