| | |
| | | } |
| | | System.debug('con.Id' + con.Id); |
| | | System.debug('con list' + con); |
| | | System.debug('con list' + con.AccountId); |
| | | //new Opportunity |
| | | Opportunity opp = new Opportunity(); |
| | | if([SELECT Id,Name FROM Opportunity LIMIT 1].size()>0){ |
| | |
| | | // opp.StageName = 'Phase3'; |
| | | // update opp; |
| | | //new Order |
| | | System.debug('opp list' + opp.Id); |
| | | List<Order> odList = new List<Order>(); |
| | | List<OpportunityContactRole> oppoRuleList = new List<OpportunityContactRole>(); |
| | | for(Integer i=0;i<num;i++){ |
| | | Order od = new Order( |
| | | Name = 'TestOrder'+i, |
| | | Status = 'Draft', |
| | | Status__c = 'Active', |
| | | AccountId = '0060K00000QulEFQAZ', |
| | | AccountId = con.AccountId, |
| | | ApproveStatus__c = 'Draft', |
| | | OpportunityId = '0060K00000QulEFQAZ', |
| | | OpportunityId = opp.Id, |
| | | // ForeignTradeCompany_D__c = con.AccountId, |
| | | EffectiveDate = Date.today(), |
| | | IE_SP5_D__c = true, |
| | |
| | | SpecialDeliveryAccount_D__c = con.AccountId, |
| | | SpecialDeliveryContact2_D__c = con.Id, |
| | | EndUser__c = con.Id, |
| | | EndUserD__c = '0060K00000QulEFQAZ' |
| | | ); |
| | | EndUserD__c = con.Id, |
| | | SpecialDeliveryContact2__c = con.Id |
| | | ); |
| | | OpportunityContactRole oppoRule = new OpportunityContactRole(); |
| | | oppoRule.OpportunityId = od.OpportunityId; |
| | | System.debug('oppoRule.OpportunityId' + od.OpportunityId); |
| | | oppoRule.ContactId = od.EndUser__c; |
| | | oppoRule.Role = 'End user'; |
| | | oppoRule.IsPrimary = true; |
| | | oppoRuleList.add(oppoRule); |
| | | odList.add(od); |
| | | } |
| | | insert oppoRuleList; |
| | | insert odList; |
| | | return odList; |
| | | } |