function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rahul JenRahul Jen 

Need answer for pd2 _ Trigger

User-added image
Deepali KulshresthaDeepali Kulshrestha
Hi Rahul,

I was going through your code snippet and I figured that option (A) is the best solution. 
Because when you use this code snippet with the help of first for loop you get all account id of all opportunity which is present in opportunityList and with the help of the second loop you get all the contact related to accountIds.  

Option (B) is wrong because contactIds initialization is not done.

Option (C) the best practices of salesforce has not been followed.

Option (D) is wrong because of this list.AccountID is used and the list is not a type of Ids.


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com