You need to sign in to do that
Don't have an account?
Manfred Linzner
Creating EmailMessage and associating with a Contact via API possible?
I'm working on a project where (already sent) emails should be saved to Salesforce and matched with the corresponding Salesforce contact.
Creating new Emails is rather straightforward. For example using the simple_salesforce python library my code looks like this:
This successfully creates a new EmailMessage but the message is not matched to the contact (assuming bar@example.com is an exisiting contact in Salesfored). This can be seen in numerous places in the Salesforce UI. For example:
It is not part of the contact's activity history
When looking at the Email Message details, the section “Sender and Recipients” is empty
When creating new emails using the Salesforce UI, the association is done correctly. Comparing my EmailMessage objects from the ones generate by Salesforce there is one obvious difference: ActivityId is not set for my objects.
When I'm trying to set ActivityId to a matching Contact ID I receive a Malformed Request Exception INSUFFICIENT_ACCESS_OR_READONLY.
Am I missing something? Is it somehow possible to create those associations using the API?
Creating new Emails is rather straightforward. For example using the simple_salesforce python library my code looks like this:
from simple_salesforce import Salesforce […] sf = Salesforce(instance_url=instance_url, session_id=session_id) sf.EmailMessage.create( {'FromAddress': 'foo@example.com', 'ToAddress': 'bar@example.com', 'Subject': 'Email: Fancy Subject', 'TextBody': 'lorem ipsum dolor sit amet', 'Status': 2 })
This successfully creates a new EmailMessage but the message is not matched to the contact (assuming bar@example.com is an exisiting contact in Salesfored). This can be seen in numerous places in the Salesforce UI. For example:
It is not part of the contact's activity history
When looking at the Email Message details, the section “Sender and Recipients” is empty
When creating new emails using the Salesforce UI, the association is done correctly. Comparing my EmailMessage objects from the ones generate by Salesforce there is one obvious difference: ActivityId is not set for my objects.
When I'm trying to set ActivityId to a matching Contact ID I receive a Malformed Request Exception INSUFFICIENT_ACCESS_OR_READONLY.
Am I missing something? Is it somehow possible to create those associations using the API?
Did you find any solution for this. I'm also facing the same issue. How to connect Email Message to Contact?