Bro do more more trigger scenarios bro.....thank you so much bro..... subscribed liked and rang the bell
I have a doubt here In this trigger example, you are inserting the list at the end. But in other trigger examples, you are updating the list at the end. Why is that, and how to identify when to use update operation on the list and when insert?
Your code is incorrect, Sir. You are iterating the OpportunityList for creating the asset, so let say if 2 Products are getting inserted from the same opportunity then according to your code only 1 asset record will be created. The loop should have been iterated over OppLineItems to create as many Assets as the number of OppLineItems are getting inserted.
Bro here one problem is there if you create two three products at a time this code will create only one asset for two three profucts
what if for(OpportunityLineItem oli : newList){ accList.add(oli.opportunity.accountId); } i fetch directly accountId and then query on the account like (List<Account> featchedAccouts = [select id, name from account where id in : accList];) and now create an asset. This can also be the solution in this you have to query only one time. Please let me know i am correct or not ?
@arunimakashyap6207