From 59c783da381ee6437ef9d9ee496f91bff1f78c2f Mon Sep 17 00:00:00 2001 From: 涂煌豪 <tuhuanghao@prec-tech.com> Date: 星期一, 21 三月 2022 17:53:01 +0800 Subject: [PATCH] SWAG-CBUB2W【委托】【优先】询问单相关修改 --- force-app/main/default/classes/InquiryFormHandler.cls | 37 ++++++++++++++++++++++++++++++++++++- 1 files changed, 36 insertions(+), 1 deletions(-) diff --git a/force-app/main/default/classes/InquiryFormHandler.cls b/force-app/main/default/classes/InquiryFormHandler.cls index ffe6238..0d39970 100644 --- a/force-app/main/default/classes/InquiryFormHandler.cls +++ b/force-app/main/default/classes/InquiryFormHandler.cls @@ -15,9 +15,15 @@ protected override void beforeInsert() { beforeExecute(); + //瀹㈡埛浜哄憳褰曞叆鍚�,銆愮數璇濄�戙�愰偖绠便�戣嚜鍔ㄥ綍鍏� thh 20220321 start + getContactInformation(); + //瀹㈡埛浜哄憳褰曞叆鍚�,銆愮數璇濄�戙�愰偖绠便�戣嚜鍔ㄥ綍鍏� thh 20220321 end } protected override void beforeUpdate() { beforeExecute(); + //瀹㈡埛浜哄憳褰曞叆鍚�,銆愮數璇濄�戙�愰偖绠便�戣嚜鍔ㄥ綍鍏� thh 20220321 start + getContactInformation(); + //瀹㈡埛浜哄憳褰曞叆鍚�,銆愮數璇濄�戙�愰偖绠便�戣嚜鍔ㄥ綍鍏� thh 20220321 end } protected override void afterInsert() { @@ -95,7 +101,36 @@ nObj.Product1_Manual__c = ''; } } - + + //瀹㈡埛浜哄憳褰曞叆鍚�,銆愮數璇濄�戙�愰偖绠便�戣嚜鍔ㄥ綍鍏� thh 20220321 start + private void getContactInformation(){ + List<String> ContactIdList = new List<String>(); + List<Contact> ContactList = new List<Contact>(); + Map<String, Contact> ContactMap = new Map<String, Contact>(); + for(Inquiry_form__c nnObj : newList) { + if(String.isNotBlank(nnObj.Contact_Name__c)){ + ContactIdList.add(nnObj.Contact_Name__c); + } + } + if(ContactIdList.size() > 0){ + ContactList = [select id, Phone, Email from Contact where Id IN :ContactIdList]; + for(Contact contact : ContactList){ + ContactMap.put(contact.Id, contact); + } + } + for(Inquiry_form__c nnObj : newList) { + if(String.isNotBlank(nnObj.Contact_Name__c)){ + if(String.isNotBlank(ContactMap.get(nnObj.Contact_Name__c).Phone)){ + nnObj.Phone__c = ContactMap.get(nnObj.Contact_Name__c).Phone; + } + if(String.isNotBlank(ContactMap.get(nnObj.Contact_Name__c).Email)){ + nnObj.Email__c = ContactMap.get(nnObj.Contact_Name__c).Email; + } + } + } + } + //瀹㈡埛浜哄憳褰曞叆鍚�,銆愮數璇濄�戙�愰偖绠便�戣嚜鍔ㄥ綍鍏� thh 20220321 end + // 鎴樼暐绉戝鐨勪富鎷呭綋 銈掑彇寰椼�両nquiry_form__Share銇ō瀹�(Read) // private void shareToOSCM() { // //瀛樻斁鐢ㄤ簬鏂板鐨勫叡浜暟鎹� -- Gitblit v1.9.1