Trigger Update Contact record using trigger when account record is updated
Trigger Update Contact record using trigger when account record is updated
Trigger Class:
trigger updateContact on Account (after update, before update){ List<Contact> contactList = new List<Contact>(); List<Contact> contactList1 = new List<Contact>(); for(Account acc: [SELECT Id,(SELECT Id,checkbox__c FROM Contacts)
FROM Account WHERE Id in: Trigger.new]){
If(acc.Contacts.size()>0){ contactList.addAll(acc.Contacts);
} }
for(contact c:contactList){ c.checkbox__c=true; contactList1.add(c); }
try{
update contactList1;
}catch(Exception e){system.debug('e');}}*** Trigger Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ***
Trigger Upsert Contact record using trigger when account record is updated
Upsert Trigger Class:
trigger upsert Contact on Account (after update, before update, after insert, before insert){
List<Contact> contactList = new List<Contact>();
List<Contact> contactList1 = new List<Contact>();
for(Account acc: [SELECT Id,(SELECT Id,checkbox__c FROM Contacts) FROM AccountWHERE Id in: Trigger.new]){
If(acc.Contacts.size()>0){
contactList.addAll(acc.Contacts);
}
}for(contact c:contactList){
c.checkbox__c= false;contactList1.add(c);}
try{
Upsert contactList1;
}catch(Exception e){system.debug('e');}}*** Trigger Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ***
Visualforce Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ⇒ *** Comming Soon ***
Apex Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ⇒ *** Comming Soon ***
Lightning Component Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ⇒ *** Comming Soon ***
Lightning Design System Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ⇒ *** Comming Soon ***
Freelancing Services At Salesforce: Freelancing Services
How to Create Object at Salesforce Classic:- https://sujay-salesforce.blogspot.com/2019/04/how-to-create-object-at-salesforce.htmlWhat is Workflow Rule At Salesforce:- https://sujay-salesforce.blogspot.com/2019/04/what-is-workflow-rule-at-salesforce.htmlHow to Create Field at Salesforce Classic:- https://sujay-salesforce.blogspot.com/2019/04/how-to-create-field-at-salesforce.htmlWhat is a Trigger:- https://sujay-salesforce.blogspot.com/2019/08/what-is-trigger.html
Comments
Post a Comment