Fix ‘Error: Field is not writeable’ for Master-Detail relationship

An error “Error: Field is not writeable” will occur if you try modifying a Master-Detail relationship field in Salesforce Apex code. So how can we fix it?

Maybe using the clone method to insert&delete is the only way, as the following apex code :

Reference:Apex System SObject Clone

Enjoy It!

Related Post

Salesforce Smart Importer – 1-Drag to import... This is my third Chrome Extension named Salesforce Smart Importer (Other two popular extensions are Salesforce Mass Editor and Salesforce DevTools), it is designed for Salesforce not only admin but also normal user, supports : ・1-Drag to import any Excel / CSV data on anywhere in Salesforce, both ...
Salesforce Mass Editor (Chrome Extension) – ... This's my second Chrome Extension (First one is HERE) this year, named "Salesforce Mass Editor" and it supports for doing the below things : ・Makes any Salesforce list view to be a powerful mass editor. ・Mass insert, mass clone, mass update, mass delete, ALL-IN-ONE. Support for both Classic and ...
Setup an awesome Salesforce developer environment ... Why Sublime Text 3 ? I've been working with Force.com for about 2 years, and always using Eclipse+Force.com IDE(See here, Eclipse Force.com IDE Installation)as my development environment. I don't think it is really difficult to use, but it could be more friendly. For example: 1. It doesn't suppo...
Using URL parameters on Salesforce standard pages Salesforce has many URL parameters can be used on its standard page, with this kind of parameters, you can do some URL hacking on it, as below: Note: All of parameters must be encoded with UTF-8. Login page There are two ways to login and access into Salesforce from url. 1. https://

Post Tagged with , , ,