Today I came across a situation where I wanted to include a field name into a formula field that returns a URL as text and will be displayed on a page layout. This URL will be used subsequently in an email template.
Here is an example of the formula field value that I want to display on the page layout exactly as it is:
http://mysite.force.com?id={!Campaign.Id}
When you create your formula and select the formula field type as “Text” and enter the above text surrounded by single quotes, Salesforce strips the flower-brackets ‘{}’ and the exclamation mark ‘!’ around the above field when you save the formula.
I did a little experiment with the above and when I removed the closing bracket it was keeping the rest of the string untouched. So it ended up like the below:
http://mysite.force.com?id={!Campaign.Id
But, I want to have field value to have the closing } so that you can copy and paste it into an email template.
The only way that I could solve this is by adding an additional formula field that has its text value as ‘}’ (Closing_Brace__c below) and changing the the original formula like this:
'http://mysite.force.com?id={!Campaign.Id' & Closing_Brace__c
Watch the single quotes around the first part of the above formula text.
If you know a different approach to solve this, please kindly let me know through your comments below.
Thanks


