public without sharing class ProductSetTrigger { public ProductSetTrigger() { } public static void CopyProductSetDetail(List newList, Map newMap, List oldList, Map oldMap){ System.debug('CopyProductSetDetail===========> Start'); Product_Set__c pd = newList[0]; if (pd.RefertoID__c != null) { List psdList = [select Product_Set__c, Product_SFDA_Status__c, Price__c, Quantity__c, Stop_Quantity__c, Contain_stop_product__c, Judge_SFDA_status__c, Asset_Model_No__c, Product__c, Product_RMB__c, Product_USD__c, Product_Set_CD__c, Total_price_RMB__c, List_price_total_RMB_text__c, Code__c, Total_Price__c, Description__c, CurrencyIsoCode from Product_Set_Detail__c where Product_Set__c = :pd.RefertoID__c]; if (psdList.size() > 0) { List psdListNew = psdList.clone(); for (Product_Set_Detail__c psdDetail : psdListNew) { psdDetail.Id = null; psdDetail.Product_Set__c = pd.Id; } System.debug('psdListNew===========> ' + psdListNew); insert psdListNew; } } System.debug('CopyProductSetDetail===========> End'); } }