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
JFraumeniJFraumeni 

Updating ParentId in Notes and Attachments Broken?

Sorry for all of these questions. Hopefully my last one for a bit:

I'm using the SOAP 2.5 API and the a user with System Administrator privileges.
In the past (less than a month ago) I was able to update the ParentId field for Attachments and Notes. For some reason, this has ceased to work now, it seems. DescribeSObject still tells me I have the permissions to do as such, but I get back a INVALID_FIELD_FOR_INSERT_UPDATE error with the message 'bad field names on insert/update call: ParentId'. ParentId has worked, and is listed under Notes and Attachments in both the 2.5 and 3.0 enterprise.wsdl files. My other updates of Id fields are working perfectly. Thanks for the help, if anyone has any insight. Here is a copy of the body of a failed update request:

<ns0:update ns1:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns0="urn:partner.soap.sforce.com" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
<sObjects ns2:type="ns3:Attachment" xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns3="http://www.w3.org/2001/XMLSchema">
<Id ns2:type="ns0:ID">
00P30000000dtecEAA
</Id>
<ParentId ns2:type="ns0:ID">
00130000001idkEAAQ
</ParentId>
</sObjects>
</ns0:update>


And a copy of a successful update request made at the same time with the same code on a different loop iteration on a Contact record:


<ns0:update ns1:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns0="urn:partner.soap.sforce.com" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
<sObjects ns2:type="ns3:Contact" xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns3="http://www.w3.org/2001/XMLSchema">
<Id ns2:type="ns0:ID">
00330000001A3niAAC
</Id>
<AccountId ns2:type="ns0:ID">
00130000001idkEAAQ
</AccountId>
</sObjects>
</ns0:update>
GlennWGlennW

Although I use the partner WSDL I have found that in 2.5 and 3.0 that the ParentID for Notes and Attachments is not updateable.  The only solution that I have found is to "Clone" the Note or Attachment object and then change the "ParentID" of the new object before you create it and then delete the old note or attachment.

Cheers;
GlennW