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
sd2008sd2008 

How to update a master/detail field or lookup field

I got an error message :

Attempting to update (as part of an upsert) parent field obj__c with new value a0740000002T9LgAAK, current value is a0740000002T9LmAAK116

Best Answer chosen by Admin (Salesforce Developers) 
aalbertaalbert
https://na3.salesforce.com/help/doc/user_ed.jsp?section=help&target=relationships_manytomany.htm&loc=help&hash=JORelationships

All Answers

aalbertaalbert

This looks identical to this posting

 

You can't modify the Master-Detail field when updating/upserting. In other words, you can't reparent if defined as Master-Detail.

sd2008sd2008

Is there a way to work around this?

 

thanks

aalbertaalbert

if you want to re-parent the master-detail relationship, you need to perform a delete and insert. its not a clean solution, but its a workaround.

 

sd2008sd2008

thanks

sd2008sd2008
What is the difference between Master/Detail Field type and Lookup Field Type?
aalbertaalbert
https://na3.salesforce.com/help/doc/user_ed.jsp?section=help&target=relationships_manytomany.htm&loc=help&hash=JORelationships
This was selected as the best answer
MrBrianMrBrian
I found I was receiving this error simply because I had not enabled reparenting on the master-detail relationship.