apex trigger interview questions scenario based || Part 2
ฝัง
- เผยแพร่เมื่อ 25 พ.ค. 2024
- In this video i am sharing :
apex trigger interview questions scenario based
salesforce coding interview questions
apex trigger scenarios
Want to Connect with me one to one :
topmate.io/salesforce_in_5_minutes
Great explanation. Can you please explain the difference between put and add method as I am very much confused when to use which.
Thanks a lot 😃
1) When you are using maps thats when you use put
For example
map mymap = new Map() ;
mymap.put('A', ' subscribe ') ;
2) when you are using lists / sets we use add function instead
List mylist = new List () ;
mylist.add('sf in 5 minutes') ;
Excellent 👌, after completed the code please test and show the result the functionality in Salesforce UI
Thanks,
It works i have tried it, note pad shows the whole view hence i coded there
Hii Bro!! Next time can you write the handler class while writting the triggers
Suree 😀
Here.
Thats scenario where one parent having 2 childs and if one of child is updated, update the another child of same parent
Again thanks a lot man i have reuploaded the video for part 3 🙏🙏 sorry for not reviewing properly
Hi I am struggling to understand this Logic because how it will prevent automatically to unchecked other contacts
Can you please write a explanation of this code in chat I am little confused
Suppose we have 10 contacts associated to an account and there's 2 contacts that are active. Now if i try to update 5 contacts that are inactive to activate, then all these 5 contacts will be active and the 2 existing contacts which were active will be inactive. But the requirement is only to have 1 active contact for an account. How can we do this sir?
You have to further write a before trigger to validate that any account must only have one related contact as active, if some one tries to make multiple active then throw error
@@salesforcein5minutes makes sense thanks