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
Rom_Rom_ 

Inbound email to custom object related by text string in email

Hello all,

 

Is it possible to setup inbound emails (using Email Services) to save to a new record in a custom object or Activity History and populate a lookup field in that object with a text string in that email?

 

Purpose:

We have a custom object Tickets__c that we send out emails from. The emails sent from a Ticket get saved in Activity History, I need a way to save and relate incomming emails (responses) to the Tickets as well.

 

Thank you so much for any help you can provide.

Best Answer chosen by Rom_
Rom_Rom_

Can I use something like this?:

String Ticketid = extractRef(email.subject)

All Answers

sfdcfoxsfdcfox
You can do this the same as email to case performs its work; have a text string inside the email body or header, such as "[ref:a013.abcde:ref]". Assuming the emails are generated by a template or Apex Code, this should be easy. Otherwise, you'd need something a little more complex in order to figure out where it should be attached to.
Rom_Rom_

Thanks Brian. I am not a coder though and having difficulty finding documentation on how to relate from anything other than the from address. Any way you can help with that?

 

Thank you in advance.

Rom_Rom_

Can I use something like this?:

String Ticketid = extractRef(email.subject)
This was selected as the best answer