Apex Triggers - 3 (Update Child by Parent)
ฝัง
- เผยแพร่เมื่อ 15 ธ.ค. 2022
- 💻 Join the Titan Community : Discover Exclusive Insights on LinkedIn / mycompany
💻 Explore the Power of Titan : Visit Our Official Website Now 🔗 titandxp.com/ - วิทยาศาสตร์และเทคโนโลยี
Not pointing out mistakes but you wrote for isAfter : before record gets saved, I was making notes but thought this is not correct so i saw you also have the same thing but you explained it right. but as i was making notes from your ppt i thought it to be wrong please take caution with the PPT.
Apart from that amazing job I'm going to finish the entire playlist thank you for this playlist.
Nice Explanation
Helpful for us and you are explaining in easy way
thank you so much
Thank you
Very helpful and you make it very easy to understand
thank you so much
thankyou
Please see to it I think after triggers it will be fired after the record is saved you said it correctly but there's a printing mistake for isAfter context variable
Great observation!!
Thanks for noticing there is a printing mistake.
Informative 👍
Thank you so much
Very good video
Thank you so much
why am I getting error whenever I insert a new record with phone number?
Hello sir ! In line no.19 can we do f Account .phone through child to parent query and instead of fetching Account ID
Con.phone = Con.Account.phone;
such a good job really wonderfull sir supperb teaching yahaaaaaaaaaaaaa🥳🥳🥳🥳
Thank you so much 😀
very easy to understand
Thank you so much
Thanks sir
No worry buddy
Please make a video whenever contact description field is updated update the related account description field
sure Saurabh you will get it in the next video
Thank you so much ❤
is this cover Bulk records update as well ??
Iam created Apex Handler Class in that i have written Logic and i wnat to call the logib from trigger how can i call ? and the logic is same as yours ??
Trigger :
if(trigger.isafter && trigger.isupdate){
AccountHandler.updatechildrecords(trigger.new, trigger.OldMap);
}
Error is showing : what can i do ??
Method does not exist or incorrect signature: void updatechildrecords(List, List) from the type AccountHandler
Hey buddy its late but did you got the answer
Hi can anyone tell me why I'm not getting any changes in account object even tho I have done all the steps just like video .! 😮
Hi can you please share your code
Sir How to write Test Class For this ?
you just need to create test data in your test class according to trigger, don’t worry I will upload test classes for all triggers soon.
@@sfdcninjas have you uploaded the test classes yet?
Hi , don’t worry i am going to start a video series on test classes soon
Hi Sir, Thanks for the explanation
I wrote the code below for the scenario mentioned in this video (This code also works).
Can you please let me know the drawbacks of this code as compared to yours
trigger AccountTrigger on Account (after update) {
Set accIds = new Set();
if(Trigger.isAfter && Trigger.isUpdate){
for(Account a: Trigger.new){
accIds.add(a.Id);
}
List conList = [SELECT Id, Phone from Contact where AccountId IN: accIds];
for(Account acc: Trigger.new){
for(Contact con: conList){
con.Phone = acc.Phone;
}
}
update conList;
}
}
Hi Buddy, 1. if your code is dependent on change of particular field then before record id in set you can apply a check on it like if(ac.Phone != null && a.phone != trigger.oldMap.get(a.Id).Phone)
{
accIds.add(a.Id);
}
2. null checks on the list which is being used in code to avoid null pointer exception.
3. bulk updation
@@sfdcninjas Thanks for the quick reply. Hope your channel becomes the most subscribed SF youtube channel
thanks for your support buddy , keep watching