18 Trigger Scenario | Before Delete | Custom Validation in Apex Trigger | try & catch in Test Class

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ม.ค. 2025

ความคิดเห็น • 10

  • @SanjayGuptaTechSchool
    @SanjayGuptaTechSchool  2 ปีที่แล้ว

    For Online Individual or Group Training Please Email or Visit below Website.
    Email: sanjaygupta.techschool@gmail.com or Visit: studysalesforce.com/
    Connect with Sanjay Gupta on Linkedin: www.linkedin.com/in/sanjay-gupta-bb2a79bb/
    Udemy : Enroll Salesforce Flow Builder Masterclass: kadge.io/flowbuilder
    Udemy : Enroll Salesforce Admin Certification Masterclass : kadge.io/admin201
    Udemy : Enroll Salesforce PD1 Certification Masterclass : kadge.io/pd1
    Please like and subscribe to support the efforts.

  • @mchan9424
    @mchan9424 ปีที่แล้ว +1

    thank you so much sir!

  • @samsir8317
    @samsir8317 2 ปีที่แล้ว +1

    Sir plzz upload more videos on LWC

  • @TheegalaNaveenkumar08
    @TheegalaNaveenkumar08 2 ปีที่แล้ว +1

    Tq

  • @mchan9424
    @mchan9424 ปีที่แล้ว

    hi sir @sanjayGupta , why we should use trigger.old?

    • @mchan9424
      @mchan9424 ปีที่แล้ว

      still i cannot understand!

    • @nikhiltripathi2760
      @nikhiltripathi2760 ปีที่แล้ว +1

      @@mchan9424 beacuse you are deleting record which is old

  • @nikhiltripathi2760
    @nikhiltripathi2760 ปีที่แล้ว

    use false in last assertion method

  • @mchan9424
    @mchan9424 ปีที่แล้ว

    Suggestion: Below code is much simpler to understand for beginners
    insert accList;
    boolean exceptionThrown=false;
    try
    {
    delete accList;
    }
    catch(exception e)
    {
    exceptionThrown=true;
    System.assert(e.getMessage().contains('Warning!: Active Account can\'t be deleted!'), 'Exception was not thrwon');
    }
    Test.stopTest();
    system.assertEquals(true, exceptionThrown);