try{
}catch(DMLException e){
         for (Integer i = 0; i < e.getNumDml(); i++) {
            // Process exception here
                System.debug(e.getDmlMessage(i));
                LineItemList [i].adderror(e.getDmlMessage(i));
        }

     }

Written by 

Salesforce MVP | Lightning Champion | 16x Salesforce Certified | Application Architect | 6x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *

*