function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

A way to auto-populate "To" for opportunity emails

Hi everyone,


We have a custom lookup to contact on our opportunity object.  The users would like the email on that contact to be the default value when the user clicks "Send An Email" on the opportunity.  Following is what I've tried/thought about.


1) Add a visualforce chunk to the task layout that copies the value to the "To" box.  I'm not sure that's possible, I haven't tried reaching outside the boundries of my visualforce page before.  But even if It were, when I add a visualforce chunk to the layout it a) does not appear on the screen for new tasks, just existing tasks and b) does not appear on the send an email page at all


2) Rewrite the whole "Send An Email" page in Visualforce and have the button go there.  Besides seeming like a pain and a wasted duplication of effort, I imagine I will at the least lose the spell check functionality.  I will no doubt get complaints about that.


Am I missing an easier way in my tiredness?


It appears you can override the send an email button with an s-control.  Could you go this route and if the current record is an opportunity, pull the information that you need from the contact and pass it through to the send an email form on the url, otherwise send straight through to the url.  I've passed information through to task create in this way before. 




The s-control would work though for some reason I had thought we can't create new ones.  I guess we can for a little longer.


I also realized I could do this with a custom button a la...




I was right, no more s-controls as of 4/1/2010.


So my button works, but I can't override with it.  I can only put it up on the top of the page.


Or I could build a VF chunk to replace the activity area which is probably what I'll do.