October 20, 2011

Formula showing a URL with {!}

by Venkat Polisetti

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:


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:


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.


September 12, 2011

Adding Reply and Forward buttons to the email activity page layout

by Venkat Polisetti

Many times when I am going through the Activity History of an Account or Contact and wanted to reply to an email or forward that to some one else, I see that the standard Activity page layout in Salesforce does not provide any buttons to do that. When you click on an Activity in the Activity History, all you see is buttons for edit/delete and follow up task or event. I wish I could directly Reply or Forward that activity from with in Salesforce without going out to my email client on my desktop. It will come handy when we do not have access to our email client for whatever reason that is.

We are going to provide the Reply and Forward Email buttons on the Task Activity page layout. To do that we need to do the following:

Add two custom buttons to the Task object

  • Crate a custom button with a lable “Reply Email”.

Head out to Yourname->Setup->App Setup->Customize->Activities. Click on Task Buttons and Links. Click New button under Cutsom Buttons and Links section at the bottom of the page.

Here is the URL text for the above button:

/_ui/core/email/author/EmailAuthor?p2_lkid={!Task.Who} &p3_lkid={!Task.What}&p6=RE:{!IF(BEGINS(Task.Subject, 'Email:'),  RIGHT(Task.Subject, LEN(Task.Subject) - 6) , Task.Subject)}&p7=%0a-------original Message-------%0a {!Task.Description}&retURL=/{!Task.Id}
  • Create a custom button with a lable “Forward Email” just like the above “Reply Email” button but use the below URL text:
/_ui/core/email/author/EmailAuthor?p2_lkid={!Task.Who} &p3_lkid={!Task.What}&p6=FW:{!IF(BEGINS(Task.Subject, 'Email:'),  RIGHT(Task.Subject, LEN(Task.Subject) - 6) , Task.Subject)}&p7=%0a-------Original Message-------%0a {!Task.Description}&retURL=/{!Task.Id}

In the above url we simply maniputlates the subject and prepend to the discription a line with a string ——-Original Message——- to seperate the original message from what you may include in your reply.

Modify Task page layouts to add the above custom buttons

  • Yourname->Setup->App Setup->Customize->Activities. Click on Task Page Laouts. Drag the custom buttons on to the layout

Thant’s all to it.


Get every new post delivered to your Inbox.

%d bloggers like this: