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.
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 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.
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
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.
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.
@@sfdcninjas tskMap should contain a List of tasks, not a single task. It should be Map tskMap. Please correct me if I am wrong.
@@RaviShankar1947 yes and we should check mapOfOppTaskList.get(opp.Id).size>0 if yes then update all tasks or else create new task
@@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.
but an opportunity might have multiple Tasks ?
Do a nested query make your life easier
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
I also got the same doubt.. @sfdcninjas
Nice explanation
Thank you
please share the code bro
hello buddy , all codes will be available on website soon.