From 2f4492ee18f90274582fcc2bb06f5e9bf64136e8 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 13 五月 2022 17:32:14 +0800
Subject: [PATCH] ProdBackup0513

---
 force-app/main/default/classes/TestDataUtility.cls |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/force-app/main/default/classes/TestDataUtility.cls b/force-app/main/default/classes/TestDataUtility.cls
index fbd5854..42d7265 100644
--- a/force-app/main/default/classes/TestDataUtility.cls
+++ b/force-app/main/default/classes/TestDataUtility.cls
@@ -471,6 +471,7 @@
         }
         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){
@@ -481,15 +482,17 @@
         // 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,
@@ -497,10 +500,19 @@
             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;
     }

--
Gitblit v1.9.1