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
Baktash H.Baktash H. 

Update List

Hello, i have a small problem...

I want to update a list like this, but it doesnt work.

 

                List<obj__c> list = [SELECT Value__c,Masterobj__r.otherValue__c FROM obj__c ];

                for(obj__c i : list){
                        i.Value__c = true;

                        i.Master__r.otherValue__c = true;

 

                }    
                update list;

 

Value__c becomes true but not    Master__r.otherValue__c. Where is my mistake?

Best Answer chosen by Admin (Salesforce Developers) 
spraetzspraetz

Updating parent records like that isn't supported.  You would need to split the Master__r record into it's own SObject and update it separately.