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
trishtrish 

Send Email to Custom Objects

Is there a way to send email to custom objects? I have a candidate object and many requirements to autopopulate the "To" field with a specific candidate and I'm unable to do this.
 
Surfwriter.comSurfwriter.com
Yes - Custom objects in Salesforce can be populated via email to Apex.
We have done some interesting things with this including parsing attached data files.
trishtrish
Thank you, Jotham. Can you please give me any leads on documentation on salesforce.com to achieve this? Appreciate your help with this.


Surfwriter.comSurfwriter.com
See "Using the InboundEmail Object" in Salesforce.com help.

Replace the Task object and its fields in the InboundEmail Object example code with your custom object and its fields.


Code:
// Create an inboundEmailResult object for returning the result of the Apex Email Service
    Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
 

  String myPlainText= '';
  
  // Add the email plain text into the local variable 
 
  myPlainText = email.plainTextBody;
 
  // New Task object to be created
 
  Task[] newTask = new Task[0];
 
  // Try to lookup any contacts based on the email from address
  // If there is more than 1 contact with the same email address,
  // an exception will be thrown and the catch statement will be called.
  try {
  Contact vCon = [Select Id, Name, Email
    From Contact
    Where Email = :email.fromAddress
    Limit 1];
  
  // Add a new Task to the contact record we just found above.
  newTask.add(new Task(Description =  myPlainText,
       Priority = 'Normal',
       Status = 'Inbound Email',
        Subject = email.subject,
        IsReminderSet = true,
        ReminderDateTime = System.now()+1,
        WhoId =  vCon.Id));
 
 // Insert the new Task 
 insert newTask;

 


monsterdustinmonsterdustin

Running into same problem:

 

Have enterprise sales cloud license. Sending inbound emails to SF using email service to a custom object which contains order information in XML that is parsed and creates/updates contacts from an order DB we use outside of SF.

 

Hitting the 1,000/day email service limitation.

 

My Question(s):

1) Do I need to buy more enterprise edition license to increase by 1,000 X new license? ...or does a less expensive "license" per org propgate an increase in limits?

2) Since I've read that SF to SF there is no limit, if I have another enterprise user license thats idle, could I send the e-mail from 3rd party app using SF e-mail and send to other user account e-mail?, ...thus creating "SF to SF" contact and not have to buy tons of more license?

 

Thanks,

 

Dustin

GuillermoPGuillermoP

You can request a black tab feature, to increate the daily limit. I have one org with 2,000.

ITCDC-AdminITCDC-Admin

Hello, hope all is well. I see where you have helped someone else needing to create email to custom object. I have a few quick questions..If you don't mind?

1. Is there a limit of the number of fields we can use on the email/forms?

2. We are wanting to just have forms on our website (like a newsletter signup) where the data from the forms will be entered directly into our Salesforce custom object. Can this be accomplished?

 

Thanks in Advance!

 

Michael