Real-World Complex Trigger Solution in Salesforce - A Complete Guide

Поділитися
Вставка
  • Опубліковано 1 жов 2024
  • Trigger Scenario - Update account with number of opportunity Line Items associated.
    🚀 Level Up Your Salesforce Skills! 🚀
    Sign up for my Salesforce Interview Prep Course and get:
    1️⃣ Access to All Recordings: Covering all the important Salesforce topics.
    2️⃣ Mock Interviews: Practice and get better at interviews.
    3️⃣ Community Support: Get your doubts answered anytime by our awesome community.
    4️⃣ Resume Review: Personalized feedback to make your resume stand out.
    5️⃣ 1:1 Career Advice: Chat with me directly about those tough career decisions.
    6️⃣ Weekend Doubt Sessions: Join live Q&A sessions to clear up any confusion.
    7️⃣ Helpful Notes: Quick and easy reference for your studies.
    💥 All of this for just ₹499, the lowest price ever! Plus, you can check out the free preview to see how we cover Salesforce topics before you decide.
    🔗 Enroll now: salesforceandi...

КОМЕНТАРІ • 16

  • @Mtripathi347
    @Mtripathi347  20 днів тому

    🚀 Level Up Your Salesforce Skills! 🚀
    Sign up for my Salesforce Interview Prep Course and get:
    1⃣ Access to All Recordings: Covering all the important Salesforce topics.
    2⃣ Mock Interviews: Practice and get better at interviews.
    3⃣ Community Support: Get your doubts answered anytime by our awesome community.
    4⃣ Resume Review: Personalized feedback to make your resume stand out.
    5⃣ 1:1 Career Advice: Chat with me directly about those tough career decisions.
    6⃣ Weekend Doubt Sessions: Join live Q&A sessions to clear up any confusion.
    7⃣ Helpful Notes: Quick and easy reference for your studies.
    💥 All of this for just ₹499, the lowest price ever! Plus, you can check out the free preview to see how we cover Salesforce topics before you decide.
    🔗 Enroll now: salesforceandinterviews.graphy.com/

  • @prasadchendake998
    @prasadchendake998 6 місяців тому

    Hii , great explanation . Are you providing any opportunities for experience candidate.

    • @Mtripathi347
      @Mtripathi347  20 днів тому

      my group have more experienced people than freshers :)

  • @shubhenduprakash588
    @shubhenduprakash588 6 місяців тому +1

    Can this be done by flow?

    • @bhi_bandari
      @bhi_bandari 5 місяців тому +1

      yes

    • @Mtripathi347
      @Mtripathi347  20 днів тому

      100 % percent, in fact I want people to try this with flow.

  • @SunilSharma-ui9sx
    @SunilSharma-ui9sx 6 місяців тому

    Hi Sir ,How can I join your Interview preparation batch.

    • @Mtripathi347
      @Mtripathi347  20 днів тому

      you can join the recorded session for now - 🚀 Level Up Your Salesforce Skills! 🚀
      Sign up for my Salesforce Interview Prep Course and get:
      1⃣ Access to All Recordings: Covering all the important Salesforce topics.
      2⃣ Mock Interviews: Practice and get better at interviews.
      3⃣ Community Support: Get your doubts answered anytime by our awesome community.
      4⃣ Resume Review: Personalized feedback to make your resume stand out.
      5⃣ 1:1 Career Advice: Chat with me directly about those tough career decisions.
      6⃣ Weekend Doubt Sessions: Join live Q&A sessions to clear up any confusion.
      7⃣ Helpful Notes: Quick and easy reference for your studies.
      💥 All of this for just ₹499, the lowest price ever! Plus, you can check out the free preview to see how we cover Salesforce topics before you decide.
      🔗 Enroll now: salesforceandinterviews.graphy.com/

  • @Soujisfmails
    @Soujisfmails 6 місяців тому

    very nice explanation

  • @Soujisfmails
    @Soujisfmails 6 місяців тому +2

    I modified little bit and included after delete event also
    trigger CountOfOLIonAcc on OpportunityLineItem (after insert,after delete ) {

    Set oppIds = new Set();
    Set accIds = new Set();

    List newoplineList = new List();
    newoplineList = (Trigger.isInsert? Trigger.New : Trigger.Old);

    for(OpportunityLineItem op :newoplineList)
    oppIds.add(op.OpportunityId);

    for(Opportunity op :[Select AccountId , id from Opportunity WHERE Id IN :oppIds ])
    accIds.add(op.AccountId);


    List aggroliList = [SELECT Opportunity.AccountId acId, count(id) oliCnt FROM OpportunityLineItem
    WHERE Opportunity.AccountId IN :accIds group by Opportunity.AccountId];
    Map OLIcnt = new Map();
    for( AggregateResult oli : aggroliList)
    {
    OLIcnt.put( (Id)oli.get('acId'), (Integer)oli.get('oliCnt') );
    }
    List newUpAccList = new List();
    for(Id accId:accIds){
    Account ac = new Account(Id = accId);
    if(OLIcnt.containsKey(ac.Id))
    ac.Count_OLI__c = OLIcnt.get(ac.Id);
    newUpAccList.add(ac);
    }
    update newUpAccList;
    }

  • @goku6986
    @goku6986 6 місяців тому

    ❤ Awesome sir