Apex Triggers - 9 (Trigger Interview Question)

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

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

  • @SachinS.M-h8w
    @SachinS.M-h8w 10 หลายเดือนก่อน +1

    Hi Sir, In this trigger if we do not update any field, just click on edit button and then clicked on save still it is updating the stageName, what will be the condition we have to avoid this? Thank you.

  • @bprakash112
    @bprakash112 หลายเดือนก่อน

    I have iterated over opportunity records,
    Select id, stagename, accountId, createdDate where accountId IN: trigger.newMap.keySet()
    Inside for loop,
    Checked the time and stagename, then updated the stage
    Is it good approach ???

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

    Hi, I have a question. How are you populating custom creater date field which you have created?

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

      GO TO -> object manager->Opportunity->New field->Test Created date->datataype=date->save

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

    Can't we write the line 27's filter condition in the SOQL query itself?

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

      Hello Abhishek,
      Thank you for your valuable comment and suggestion regarding the code. I appreciate your insight on optimizing the code by reducing the number of queries. I completely understand your point. However, it's important to consider that there might be various requirements or modifications in the requirement. That's why I have implemented the filter condition in line 27 to accommodate such potential changes.
      I hope this clarifies the reasoning behind my approach. Please let me know if you have any further suggestions or if there's anything else I can assist you with.

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

    Got the below error
    accTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0065g00000YPTm9AAH; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, oppTrigger: maximum trigger depth exceeded Account trigger event

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

      Deactivate oppTrigger

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

      Recursive trigger problem.

    • @anubhav111196
      @anubhav111196 10 หลายเดือนก่อน

      you have reached the end of heap size, so check in your previous triggers where it is going in loops

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

    Hi,thanks for Sharing the senarios...it helps me a lot .
    Can u make Vedios on test classes.
    Thanks.

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

      sure i have test classes in my plan

  • @harinath1821
    @harinath1821 9 หลายเดือนก่อน

    Can't we use standard field created in query??

    • @JShorts511
      @JShorts511 5 หลายเดือนก่อน +1

      We can use it and for testing purpose we can use Test.setCreatedDate(recordId,date) in apex testing