You need to sign in to do that
Don't have an account?
Kaity
Need Dynamic Link
I'm sending mail. And while doing so, I have given a link as below:
CaseNotificationmail.setPlainTextBody('Your case Status: ' + c.CaseNumber + 'To view your case <a href=https://na1.salesforce.com/' + c.Id);
But, I think, this a not a good practise because Salesforce may change the instance from n1 to n2 or n3. At that time this code will fail.
Is there any way to make it dynamic?
-Kaity
Try:
'Your case Status: ' + c.CaseNumber + 'To view your case <a href=https://' + System.URL.getSalesforceBaseUrl().getHost() + '/'+ c.Id);
All Answers
Hi,
You can use
it will return you:
'na1.salesforce.com'
But , what would be the syntax , if you want to write the following code:
'Your case Status: ' + c.CaseNumber + 'To view your case <a href=https://na1.salesforce.com/' + c.Id);
Try:
'Your case Status: ' + c.CaseNumber + 'To view your case <a href=https://' + System.URL.getSalesforceBaseUrl().getHost() + '/'+ c.Id);
You are absolutely correct. Big thanks..
-Kaity