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
SF@SiemensSF@Siemens 

Send email from opportunity

Hi,
 
Is there any way to create an email from an opportunity ONLY when a date field in the opportunity meets a certain condition AND it needs to be sent to the primary contact of the opportunity (which changes with each record).
 
I have been able to create an email that will send to the primary contact but I am not sure how to specify a condition as well.
 
Thanks for your time,
WhyserWhyser
What are you using to create the email or how are you doing it right now?
 
Instead of using AJAX, you could do a workflow rule in which you can define conditions such as your date field which would trigger it to run. You can then associate the workflow rule with an outbound messaging to a web application that can do the sending of the email to the primary opportunity contact.
SF@SiemensSF@Siemens
I created a URL from a working (standard) email button and modified it to add the "to" field as the primary contact.  I see where you are going with your idea and I may give that a shot to see what I come up with.
 
Thanks for your help!
WhyserWhyser
There are other ways to do it, I just gave a complicated example.
 
If you are willing to write an s-control for it, you can follow the example on this page
 
 
With this, you can use javascript to control whether or not you attempt to send an email by querying your date field as you needed.
 
The other thing you can do, also via s-control, is to follow the ideas on this thread
 
 
With the last two links, their method will open up a window in which it will show the standard Salesforce "Send an Email" page, with parameters you pass into the page that will auto fill into the email form. The only major advantage to this method is that it allows you to have attachments using Salesforce's standard email functionality.
 
But again, with any of the methods here, you can use javascript to retrieve the date field you want, then decide whether to follow these email examples.


Message Edited by Whyser on 06-04-2008 08:07 AM
SF@SiemensSF@Siemens
Thanks a lot Whyser!  I really appreciate your post.  I am going to get started on the S-Control now (that seems like the best possibility from what I am seeing now)
 
Thanks again!
Rasmus MenckeRasmus Mencke
If you are in an Enterprise or Unlimited Edition org, you could use Apex Code to send the email.

A click on a button could trigger a piece of Apex Code to fire and send the email off. In your Apex Code you validate the date is set correctly before sending the email.