1

I want a button on a custom object (which is similar to standard Contact object) to send email. On button click, an email should be sent. I tried with location.replace('/email/author/emailauthor.jsp?retURL=/{!Temporary_Contact__c.Id}&rtype=003&p2_lkid={!Temporary_Contact__c.Temporary_Contact_Email__c}&template_id=00X1F000000DbdC&p5=&save=1'); but on button click, an email screen page appears to select additional details. Like this-enter image description here I do not want this screen. I appended &save=1, yet the screen appears. Please someone guide me how to send email just on a single button click!

Thanks in advance.

3
  • No it is not. The title to that link is misleading! Oct 10, 2017 at 9:40
  • Well, what does your url look like when it enters this page? Looks like the "temporary contact email" field is blank for this particular record. Also can you make it a normal URL button/link, no JavaScript and see what happens? Maybe there's some urlencoding happening to "@" symbol that confuses the form. Also remove "save=1" for now, let's see the page with params passed (or not) before it attempts the send.
    – eyescream
    Oct 10, 2017 at 10:05
  • Thanks for your response @eyescream. The URL on button click looks like this- salesforce-instance/email/author/emailauthor.jsp?retURL=/…. Is it possible to exclude the email details page? Oct 10, 2017 at 11:18

1 Answer 1

1
  1. Start with just /email/author/emailauthor.jsp?p24=abc@abc.com&template_id=00X1F000000Dboe and see if it populates the "Additional To" (even if the email template will not merge properly because it lacks the custom object's id & save parameter).
  2. If it works - add back the p3_lkid and see if it breaks (I'm not even sure where did you get p3 from, contact should go to p2. And your original url doesn't mention it.)

I suspect the object is not configured to "allow activities" (incl email). Is this a sandbox? Did you remember to check Setup->Deliverability after refresh & allow all email?

Generally - add &save=1 as last step, once you have everything else prepopulating OK.

More info: Sending Email using Email Author in custom button

6
  • Yes it is a sandbox. Object is configured to "Allow Activities". Deliverability Access Level is set to "All Email". What &save=1 does, could you please explain? Oct 10, 2017 at 12:02
  • Simulates clicking "send", "submit", "save" etc buttons on various standard SF pages (right click the send button and inspect it's name in html). After successful send you'll go back to retURL or if none specified - home page. Generally I'm advising to leave it off until you're sure other parameters work OK, add it as last step of the automation
    – eyescream
    Oct 10, 2017 at 12:06
  • Oh thank you. I referred this link. Its mentioned there in a single click the mail can be sent. Is it possible to send email just on a button click? Oct 10, 2017 at 12:11
  • I tried your suggestion of /email/author/emailauthor.jsp?p24=abc@abc.com&template_id=00X1F000000Dboe but got this error A problem with the OnClick JavaScript for this button or link was encountered: Invalid regular expression flags. Please help me! Oct 10, 2017 at 12:22
  • I said "Also can you make it a normal URL button/link, no JavaScript"... You might suffer form some urlencodign issues related to escaping special characters. You don't need JS for this functionality. And yes, it's possible to automate it 100%, there must be something simple you're not doing.
    – eyescream
    Oct 10, 2017 at 12:34

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