You need to sign in to do that
Don't have an account?

Default Template and Email From Address
Does anyone know of a way to automatically select a default email template and email from address for a case? Our users are still have to do a lot of clicks and sometimes forget to use the email-to-case address.
Thanks in advance, Jay
Thanks in advance, Jay
Well, as I mentioned in the blog article, as it is an unsupported API, URL-hacking can have some strange side effects, and this is one of them: if your page param doesn't match the option value exactly then you'll end up with 2 seemingly identical entries.
The trick to fixing it is to replicate the option value exactly. If I look at the source of the page I see that the picklist entry really says:
So I can make my p26 match that value exactly, with the name after the colon:
https://na1.salesforce.com/_ui/core/email/author/EmailAuthor?p3_lkid=500300000038CTu&retURL=%2F500300000038CTu&p26=support@mycompany.net:US%20Support
and the problem goes away.
All Answers
So let's say you have a template that you usually use for Cases which contains some pleasantries and then a merge field that adds in the text of any related Solutions. If you've not used Email Templates much before, by the way, have a look at the sample template entitled "SUPPORT: Case Response with Solution (SAMPLE)" -- it does just what I've described here.
Anyway, what you'll want to do is make a custom button that preselects this template. It's quite simple really.
The first thing you'll need to do is get the ID of the template you want to use. This can be found by finding the template via Setup->Communication Templates->Email Templates. Click on it and look in the URL -- you'll see an ID up there that looks like 00X30000000rNM0 (which may be followed by a ? with some other parameters -- ignore that stuff, just take the 15-character ID that starts with 00X). Copy that ID into Notepad or someplace where you can get to it later.
Now go to Case and create a Custom Button -- let's call it Email Solution. Set its Behavior to Execute Javascript and its Display Type to Detail Page Button.
In the Javascript area add this line of code, replacing the <your template here> with the ID of the template you saved earlier:
Message Edited by werewolf on 07-11-2008 09:42 AM
Thanks again, Jay
Thank, Jay
http://blogs.salesforce.com/support/2008/07/the-quick-email.html
This works very well except I have a situation where we are using "Person Accounts" . How do I get the email address from a Person Account into the 'TO' field on the Case?
Thanks,
JRB
Here I am hard-coding the value for p2_lkid; in your example above it is the Contact ID or the Account ID (for a Person account), but there isn't a corresponding ID necessarily for an Opportunity. I'd leave it out if possible, and force the user to make a selection, but leaving it blank isn't a valid choice. That particular ID is what I gathered from the address when I selected Activities/Send Email from the Opportunity; the Opp IDs I was able to locate, but I don't know where the ID ending SC8BY (line 3) came from, so I don't know what to substitute there -- I thought it might be my user id, but no ...
Message Edited by finalist on 08-26-2008 06:39 PM
I would note that you have an extra space after{!Opportunity.Id} which might be breaking your URL.
Thanks
Happy New Year
Message Edited by shan876 on 12-30-2008 10:00 AM
Thank you for these tips on how to call the Send Email page and set the To, From and Template - working just great as a custom button.
I would also like to be able to override the standard "Send an Email" button on the Email related list so that it takes this action, also. I can see that it can be overridden under Setup > Customize > Activities > Buttons. However, it doesn't appear that I can get the context for the Email Message object in order to reference the Case Id (its ParentId).
I was hoping my code in the s-control for the override of the "Send an Email" message could look something like this, but with the {!Case.Id} areas changed to reflect that I am coming from the EmailMessage type of Activity - something like this: {!EmailMessage.ParentId}. But there doesn't appear to be a merge field available for this object.
parent.location.href = "/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&template_id=00X30000001AoS9&p26=someemail@email.com&nooverride=1";
Any ideas how to override the "Send an Email" button on the Email related list, referencing values from the EmaiMessage object itself?
Thanks -
Linda
Hi,
I found a weird wrinkle in the p26=<fromAddress> behavior. Let's say I have the following email to case route:
name: FOO Customer Service
inbound email: support@foo.com
In the emailauthor URL, I put the following:
p26=support@foo.com
When the redirect to emailauthor happens, the from *seems* correct: the pulldown is selected to:
FOO Customer Service <support@foo.com>
*However*, there is another email listed in the pulldown that looks just like it. If instead of the URL, you just click reply on the original email message, only 1 email shows up. This is not the real problem. Here's the real problem.
On the client side, the email header reads like this:
name: FOO Customer Service <support@foo.com>
email: support@foo.com
The embedded email in the name messes up some email apps (probably sucky ones, but it happens). If you had just clicked reply on the original email within Salesforce, you would get this:
name: FOO Customer Service
email: support@foo.com
Which is how it should be - and which works even with crappy email processing apps.
Any ideas?
Is there a "FromName" field as well?
Anyone else experience this?
Thanks!
Well, as I mentioned in the blog article, as it is an unsupported API, URL-hacking can have some strange side effects, and this is one of them: if your page param doesn't match the option value exactly then you'll end up with 2 seemingly identical entries.
The trick to fixing it is to replicate the option value exactly. If I look at the source of the page I see that the picklist entry really says:
So I can make my p26 match that value exactly, with the name after the colon:
https://na1.salesforce.com/_ui/core/email/author/EmailAuthor?p3_lkid=500300000038CTu&retURL=%2F500300000038CTu&p26=support@mycompany.net:US%20Support
and the problem goes away.
Awesome! Totally works. This is the missing link :)
Thanks!
Thank you very much for posting this solution - it's exactly what I was looking for!
The only problem I have is that my email template also generates a PDF attachment on the fly and adds it to the email - but with this method the attachment does not get generated - any ideas?
Thanks in advance!
OK - I found the answer: you'll need to add new_template=1 to the end of the param string and then it works! Here's an example for sending a quote:
location.replace('/email/author/emailauthor.jsp?retURL=/{!SFDC_520_Quote__c.Id}&p3_lkid={!SFDC_520_Quote__c.Id}&rtype=003&p2_lkid={!SFDC_520_Quote__c.ContactId__c}&template_id=<your_template_id>&new_template=1');
Hi All-
I would like to do exactly what Linda has mentioned you have a solution for : "how to call the Send Email page and set the To, From and Template - working just great as a custom button. "
I am not seeing the solution anywhere on this discussion board.
Would anyone mind sending or re-posting the fix that worked for Linda?
Thanks!
Christina
You ROCK!
I hacked your hack so I can use "Send An Email" button on the Opportunity. We use this functionality to let a non-SFDC team know our sales guys want a quote for the customer. I can go back and add the Contact ID later, but this pops my template and data from SFDC.
location.replace('/email/author/emailauthor.jsp?retURL=/{!Opportunity.Id}&p3_lkid={!Opportunity.Id}&template_id=<insert template ID here>');
Thanks!
I am using my button on a custom object that is used both on leads and contacts. The button works fine when the custom object is linked to a Lead. It pulls the visualforce template and populates just fine. However, I want to call a different visualforce email template when the custom object relates to Contact as I have a different template for both Leads and Contacts. Is there a way to write an IF statement in the javascript?
This one works on custom object associated with Lead: location.replace('/email/author/emailauthor.jsp?retURL=/{!Request__c.Id}&p3_lkid={!Request__c.Id}&template_id=00X80000001BzPO&p3_mod=aoj');
I tried to do something like this to select the template for either Lead or Contact requests:
works: location.replace('/email/author/emailauthor.jsp?retURL=/{!Request__c.Id}&p3_lkid={!Request__c.Id}&template_id={!IF(Contact.Id==null,'00X80000001BzPO', '00X80000001Bzaf')}&p3_mod=aoj');
If this can't be done, is there a way to create one Visualforce template that contains an IF statement to display correct values?
Thanks!
Hello. I'm desperately trying to automatically include the same email signature (our logo and contact details) used within our Outlook, in the emails sent via a Contact's Activity History 'Send an Email'.
I understand that I will probably have to create a custom button, as per other responses, however I have not been successful in creating the signature as a html template for it. We don't want any copy or subject line included, as it will be for our BDMs to randomly email clients via Salesforce instead of Outlook, which is what they refuse to do due to this issue.
Would be so simple if we could just create the html signature within Email Settings section!
Any assistance would be greatly appreciated!
location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=00X30000001dwmf&save=1');
I have cases that are created in the Web to Case.
Is there a way to use this to instead email the WebEmail from my chosen case?
something like:
location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.WebEmail}&template_id=00X30000001dwmf&save=1');
Well, I figured that out, but my only issue is this wierd error I get when I try to have it send automatically.
The page you submitted was invalid for your session. Please click Save again to confirm your change.
location.replace('/email/author/emailauthor.jsp?retURL=%2F{!Case.Id}&p24={!Case.SuppliedEmail}&rtype=003&p3_lkid={!Case.Id}&new_template=1&template_id=00XS0000000Qfeb&save=1');
Hi,
I'm trying the same in Opportunity. Everything is perfect other than Contact.
For contact, I created a custom field in the Opportunity, Opportunity.Contact__c
I replaced this with contact id - but it's not fetching.
Someone please help me to sort it out.
Thanks.
Regards,
AMR.