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
Viliam LomidrevoViliam Lomidrevo 

creating EmailMessage using SOAP API. Cannot set PartnerId

Hi,

When creating the EmailMessage object using SOAP API, when I provide the PartnerID value, I get the following error:

{"hasErrors":true,"results":[{"result":[{"errorCode":"INVALID_OPERATION","message":"operation is not allowed"}],"statusCode":400}]}

The SOAP request sent to SF is:

POST https://eu11.salesforce.com/services/data/v38.0/composite/batch HTTP/1.1
Authorization: Bearer 00D0Y000000p9Bk!AQQAQBCmNW7qKOcqUQOCJG_6pzd2B8rvxxxxtZ.Nz.Ox8dyLXU0xEOXPA.Szo1eUDKxlP.RY5OZCg1w7poiT9RENvmYjf
Content-Type: application/json
Host: eu11.salesforce.com
Content-Length: 339
Expect: 100-continue
Accept-Encoding: gzip, deflate

{"batchRequests" : [{ "method": "POST","url": "v38.0/sobjects/EmailMessage","richInput": {
"FromAddress":"vilo.lomidrevo@gmail.com",
"MessageDate":"2016-12-07T16:00:00.0000000Z",
"ParentId":"5000Y000001wHitQAE",
"resco_contentstatus__c":"473220003",
"Status":"5",
"Subject":"Email Mesage 21",
"ToAddress":"rohel@resco.net"
}}]}

When the ParentID is omittedteh EmailMessage record is created sucessfully.

Am I missing something here? What is the cause of the error I am getting?

Thank you