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
giorgio70giorgio70 

Custom List Controller updating Multiple Records of different type (Account and Contact)

Hello

 

I developed a Visualforce Page with a Custom List Controller.

 

I display several Contacts in a matrix on my Page.

I display these fields:

 

- Contact First Name

- Contact Last Name

- Contact Phone

- Account Name

- Account Phone

 

I want to be able to make changes to all of these fields, and SAVE.

In this case I change Contact Fist Name AND Account Phone, I want to be able to SAVE and UPDATE both the Contacts and the Accounts records.

 

Is there a way to do this in a custom controller?

I am nos sure how my getters and setters would be defined in order to get the new values for the Account fields

 

Thanks

Giorgio

 

kerwintangkerwintang

My suggestion is to create an actionFunction that has the 5 fields as parameters.

 

Then in your controller, that action should get both the Contact and Account record, assign the field values to them, and then save the records.

giorgio70giorgio70

Thanks for the feedback.

I was able to solve this using a warpper class