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

How to update a field of a related record of an item from a collection?

I have a list of custom object (Meeting Note)and I want to be able to edit a custom field (Firm Type) from another object (Net Prospect Score) that is indirectly related to the Meeting Note object. They both have a lookup field to Contact object. Below is my attempt at an Apex class that does not work. I was able to only display the custom field but the update method does not work.
public class MeetingNoteCtrlr{

    public List<MeetingNote__c> meetingNotesOutstanding {get; set;}
    public MeetingNoteMDHomePageCtrlr() {

        meetingNotesOutstanding = [
            SELECT FIELDS(STANDARD), Name__r.Net_Prospect_Score__r.Firm_Type__c
            FROM MeetingNote__c
            ORDER BY Meeting_Date__c DESC
            LIMIT 100];
    public PageReference saveMeetingNotes() {

           update meetingNotesOutstanding;
        catch(DmlException ex){
        return null;

AnkaiahAnkaiah (Salesforce Developers) 
Hi Richard,

MeetingNote__c object, Which field you need to update the Firm_Type__c value?

Can you share the the VF page code?