Apex Triggers - 23 (Capgemini Interview Question)

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

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

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

    Hi @sfdcninjas, Thanks for sharing the amazing content
    I have one question: On line number 40, will you again not iterate on tasks? There could be more than one task in an opportunity.

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

      Hi Manish, Basically it uses a map to retrieve a task based on the opportunity ID. The purpose of this line is to check if a task already exists for the opportunity. If a task is found, it updates the task's description with information about the updated opportunity stage. If a task does not exist, it creates a new task with the necessary details.

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

      @@sfdcninjas tskMap should contain a List of tasks, not a single task. It should be Map tskMap. Please correct me if I am wrong.

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

      @@RaviShankar1947 yes and we should check mapOfOppTaskList.get(opp.Id).size>0 if yes then update all tasks or else create new task

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

      @@RaviShankar1947 Yes, you are absolutely right, the code given the video only updates one task related to the opportunity. If you have already done using the map tskmap, can you share me your code.

  • @Rohitkumar-vg5xi
    @Rohitkumar-vg5xi 6 หลายเดือนก่อน

    but an opportunity might have multiple Tasks ?

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

    Do a nested query make your life easier

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

    why did we used map.. ?After quering task if we got empty List then we can directly create new Task or else we can update task field right??? @sfdcninjas

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

      I also got the same doubt.. @sfdcninjas

  • @ARUNIMAKASHYAP-k3c
    @ARUNIMAKASHYAP-k3c ปีที่แล้ว

    Nice explanation

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

    please share the code bro

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

      hello buddy , all codes will be available on website soon.