function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
trigger AccountTrigger on Account ( after insert, after update ) { Set<String> setAccountID = new Set<String>(); For(Account acc: trigger.New) { setAccountID.add(acc.id); } List<Account> listAccount =[select id,name, (Select, firstName, LastName fromm Contacts) from account where id in :setAccountID ]; For( Account acc: listAccount ) { System.debug('----------->'+acc.Name); List<Contact> lstContact = acc.Contacts; for(Contact cont : lstContact) { System.debug('----------->'+cont.firstName); // Add all your logic here } } }
What you want to update in contacts ?
When you want to update ,on updat eof Account if yes which field value you want to update in contact ,any fields from Account or any independent contact field you need to update ?
Why not use the process builder?
You can update all child records based on parent record update.
Please see below:
https://developer.salesforce.com/trailhead/business_process_automation/process_builder
Please mark this as solution if this will help you.