Subscribe
Create Ideas from Emails
by Rasmus Mencke on June 19, 2008 at 09:55 AM
I have built an example of how you can use Salesforce Ideas and create new ideas from emails. Using Force.com Email Services to allow people to send emails and convert the emails into new Ideas.
Taking the subject line as the title of the Idea and use the body of the email as the content for the Idea.
The main class for creating the Email Services is below.
Global class IdeasSample implements Messaging.inboundEmailHandler{
Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope env ) {
Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
// Create the new Idea from the incoming email
createIdea(email.subject, email.plainTextBody, env.fromAddress);
// Set the result to true, no need to send an email back to the user
// with an error message
result.success = true;
// Return the result for the Apex Email Service
return result;
}Creating the Idea takes the subject, text body of the email and the from email address as arguments
public static Idea[] createIdea(String IdeaTitle, String ideaBody, String fromEmail) {
// instance of a new Idea
Idea[] newIdea = new Idea[0];
// create a new Idea
newIdea.add(new Idea(Body = ideaBody,
Title = IdeaTitle));
insert newIdea;
sendEmail(fromEmail,newIdea);
return newIdea;
} To see the full code sample check this out
TrackBack
TrackBack URL for this entry: http://www.typepad.com/services/trackback/6a00d8341cded353ef00e5536086ae8833
Listed below are links to weblogs that reference Create Ideas from Emails:

Comments
Posted by Kingsley Joseph on June 19, 2008 11:04 AM:
Nice!
Posted by Jamie Grenney on June 22, 2008 04:47 PM:
Very Cool Rasmus. It is kind of like American Idol. You could be in front of your TV and email an idea or even cast a vote.
Eventually you might take this one step further and create some logic to check for similar ideas. The customer might get an auto-response email saying... "Thanks for your submission. We found a couple similar ideas. Do you still want to submit your idea or would you rather cast a vote for one of the ideas below?"
Posted by Mark on September 17, 2008 06:29 AM:
Might be a stupit comment, but what is the email address you are meant to send the emails to?