Це відео не доступне.
Перепрошуємо.
All About Trigger Handler & Helper in
Вставка
- Опубліковано 17 сер 2024
- Want to learn more about salesforce join me at sfdcpanther.com Hi #Trailblazers,
In this video, you will learn all the concept of Apex Trigger Handler & Trigger Helper along with a Trigger Scenario. Below is the Agenda:-
1 - Develop a Simple Trigger
2 - Develop a trigger using Handler & Helper Class
************** PROBLEM STATEMENT ****************
Show the Error to user while deleting any account if that account associated with any closed won opportunity.
Link to Code: - gist.github.co...
Link to PPT:- www.slideshare...
ContactMe -
LinkedIn
/ simplyamit
FaceBook
/ sfdcpanther
Twitter
/ cloudyamit
Instagram
t.me/sfdcpanther
Blog
sfdcpanther.com
Email sfdcpanther@gmail.com
Previous Video
Rollup Summary Trigger for Lookup Relationship - • Rollup Summary Trigger...
Duplicate Contact Trigger - • Duplicate Contact Trig...
Collection in Salesforce - • Introduction to Set & ...
SOQL in Salesforce - • SOQL in Salesforce || ...
OAuth 2.0 :- • An Overview to OAuth 2...
#SalesforceForBeginner #Salesforce #ApexTrigger
#JourneyToSalesforce #ApexTriggerFramework
Hi Amit, I learn so many things from you. Thanks man. And the video is just awesome
Thanks man
Thank @ Amit , Excellent work once again !!!! I request you to please make some more use case videos on the trigger, trigger handler, and helper class, and test class for the same example.
Your videos are good and very helpful. Im surprised they have so less views
Can we use oldmap in the first for loop to throw the error so we don't need second trigger
Thanks buddy
Very clear explanation. What about if logic is a bit more complex and many steps are needed. Would that mean many methods within the same class? How to concatenate them?
If it's a bit complex then there might be many methods based on the requirement.
Hi Amit, Can you please provide me some trigger assignments as I want to improve my apex?
Please visit sfdcpanther.com and you will get the link for the same
You explain very well Amit, can you please help in getting a job.
No one can help you in getting the job but I can guide you that's what I can do
Ok sure Amit. Please guide me. Tell me what should I do.
📢📢
Hi Everyone,
I have prepared a document which have the complete step by step path to follow for any salesforce admin or development.
⚡⚡Link to salesforce admin and development path
📌quip.com/ubNmAMnGbFGO
This document also includes the live project
📌Link to live project
⚡quip.com/7MD7Al2cxdQA
For more join 📌
telegram.dog/sfdcpanther
@@sfdcpanther Thanks brother for the help
Hi, the video is very good
I have one generic problem statement can you solve and post.
Problem statement: When an new contact created for account we need to uncheck checkbox isLatest of pervious contact record for that account and mark isLatest for newly creating contact as checked.
Note: updating different records in same object.
Can you please solve it...
Thanks in advance
public class ContactTriggerHelper{
public static void beforeInsertContactHelperMethod(List sObjectIdList,Map sObjectNewMap){
List accountIdList = new List();
List contactList = new List();
Map accountToContactMap = new Map();
for(Contact contactIterator : sObjectIdList){
if(!accountIdList.contains(contactIterator.AccountId)){
accountIdList.add(contactIterator.AccountId);
contactIterator.isLatest__c = true;
accountToContactMap.put(contactIterator.AccountId,contactIterator);
}else{
accountToContactMap.get(contactIterator.AccountId).isLatest__c = false;
contactIterator.isLatest__c = true;
accountToContactMap.put(contactIterator.AccountId,contactIterator);
}
}
for(Contact contactIterator : [SELECT ID,isLatest__c FROM Contact WHERE AccountId IN : accountIdList]){
contactIterator.isLatest__c = false;
contactList.add(contactIterator);
}
update contactList;
}
}
I can't see your video, it's full of blur
Change the Quality of the video
what if I do like this ?
If(Trigger.isBefore && Trigger.isDelete)
{
List acclist=New List();
List accountwithopp=[Select Id,Name,
(Select Id,Name,StageName
from Opportunities
where stageName='Closed Won')
from Account];
for(Account acc:trigger.old)
{
for(Account acc1:accountwithopp){
if(acc.id==acc1.id)
{
acc.addError('You can not delete closed won opportunity');
}
}
}
}
That's your choice. No one is stopping you.
The purpose is to use Helper & handler classes because that is the best practice and easy to maintain and understand when you leave the company.
Also, If you have bulk data your code will break for querying more than 50K rows.