From 1a63180b4cabdf8b63e9a93eab8d715a72a01514 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期三, 24 五月 2023 13:36:46 +0800
Subject: [PATCH] commit

---
 force-app/main/default/classes/LayoutDescriberHelper.cls    |   21 ++++++---------------
 force-app/main/default/classes/NewAndEditLeadController.cls |   13 +++++++------
 2 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/force-app/main/default/classes/LayoutDescriberHelper.cls b/force-app/main/default/classes/LayoutDescriberHelper.cls
index 967fa25..8041efd 100644
--- a/force-app/main/default/classes/LayoutDescriberHelper.cls
+++ b/force-app/main/default/classes/LayoutDescriberHelper.cls
@@ -40,7 +40,8 @@
         requiredFieldAPIList = new List<String>();
         fieldAPIToLabelMap = new Map<String,String>();
         layoutSections = new List<LayoutSection>();
-        String theRespBody = getLayoutSchema(recordTypeId, objectType,userMode);      
+        String theRespBody = getLayoutSchema(recordTypeId, objectType,userMode);
+        System.debug('theRespBody = ' + theRespBody);      
         Map<String, Object> layoutSection = (Map<String, Object>) JSON.deserializeUntyped(theRespBody);
         Map<String,object> m = new Map<String,object>();
         if(String.isBlank(recordTypeId)){
@@ -210,32 +211,23 @@
     }
 
     public static String getLayoutSchema(Id recordTypeId, String objectType,String userMode){
-        System.debug(LoggingLevel.INFO, '*** recordTypeId: ' + recordTypeId);
-        System.debug(LoggingLevel.INFO, '*** objectType: ' + objectType);
-        System.debug(LoggingLevel.INFO, '*** userMode: ' + userMode);
         String urlPost = '/services/data/v53.0/sobjects/'+objectType+'/describe/layouts/';
-        System.debug(LoggingLevel.INFO, '*** urlPost: ' + urlPost);
         if(String.isNotEmpty(recordTypeId) && String.isNotBlank(recordTypeId)){
             urlPost = urlPost + recordTypeId;
         }
-        System.debug(LoggingLevel.INFO, '*** urlPost: ' + urlPost);
         String urlForClassic = 'https://'+getUrlPrefix()+urlPost;
+        
         system.debug('URL Post:'+urlForClassic);
-        System.debug(LoggingLevel.INFO, '*** UserInfo.getsessionid(): ' + UserInfo.getsessionid());
-        System.debug(LoggingLevel.INFO, '*** paramvalue: ' + EncodingUtil.base64Encode(Blob.valueOf(userinfo.getSessionId())));
         HttpResponse resp = null;
         HttpRequest req = new HttpRequest();         
         req.setMethod('GET');        
         if(userMode =='lightning'){
-            /*req.setEndPoint('callout:SF_Rest_API'+urlPost);
-            system.debug('callout:SF_Rest_API'+urlPost);*/
-            req.setEndpoint(urlForClassic); 
-            req.setHeader('Authorization', 'Bearer ' + UserInfo.getsessionid());
+            req.setEndPoint('callout:SF_Rest_API'+urlPost);
+            system.debug('callout:SF_Rest_API'+urlPost);
         }else if(userMode == 'classic'){
             req.setEndpoint(urlForClassic); 
             req.setHeader('Authorization', 'Bearer ' + UserInfo.getsessionid());
-        }
-        System.debug(LoggingLevel.INFO, '*** req: ' + req);       
+        }       
         Http client = new Http();    
         resp = client.send(req);
         system.debug('Schema Body:'+JSON.serialize(resp.getBody()));
@@ -278,7 +270,6 @@
     }
 public static Integer ControllerUtil() {
 Integer i = 0;
-
 return i;
 }
 
diff --git a/force-app/main/default/classes/NewAndEditLeadController.cls b/force-app/main/default/classes/NewAndEditLeadController.cls
index 10e5f33..93f597b 100644
--- a/force-app/main/default/classes/NewAndEditLeadController.cls
+++ b/force-app/main/default/classes/NewAndEditLeadController.cls
@@ -72,6 +72,7 @@
             System.debug('CF00N1000000962np_lkid');
             //浜у搧鍜ㄨ鍗曡繃鏉ョ殑
             String InquiryFormId = ApexPages.currentPage().getParameters().get('CF00N1000000962np_lkid');
+            System.debug('InquiryFormId = ' + InquiryFormId);
             ifc = [select Id,AWS_Data_Id__c,Contact_Name__c,Contact_Id__c,Hospital_Name__c,Hospital_ID__c,Department_Class__c,
             Department_ID__c,Opp_Name_Search__c,Opp_Name_Search_ID__c,Campaign__c,
             Campaign_ID__c,Name,Cancel_Reason__c,Phone__c,Email__c,Last_Name__c,LeadSource__c,Opportunity_Division__c,Request1__c,
@@ -92,12 +93,12 @@
         }else if(obj.Id != null){
             //鏇存柊
             isNewMode = false;
-            Lead leadData = [select Id,RecordTypeId,AWS_Data_Id__c,Contact_Name__r.Id,Contact_Name__r.AWS_Data_Id__c from Lead where id =: obj.Id];
-            rtTypeId = leadData.RecordTypeId;
-            AWSDataId = leadData.AWS_Data_Id__c;
+            List<Lead> leadData = [select Id,RecordTypeId,AWS_Data_Id__c,Contact_Name__r.Id,Contact_Name__r.AWS_Data_Id__c from Lead where id =: obj.Id];
+            rtTypeId = leadData[0].RecordTypeId;
+            AWSDataId = leadData[0].AWS_Data_Id__c;
             Map<String,String> sfIdToAWSIdMap = new Map<String,String>();
-            if(leadData.Contact_Name__r.Id != null){
-                sfIdToAWSIdMap.put(String.valueof(leadData.Contact_Name__r.Id).subString(0,15),leadData.Contact_Name__r.AWS_Data_Id__c);
+            if(leadData[0].Contact_Name__r.Id != null){
+                sfIdToAWSIdMap.put(String.valueof(leadData[0].Contact_Name__r.Id).subString(0,15),leadData[0].Contact_Name__r.AWS_Data_Id__c);
             }
             contactsInfo = JSON.serialize(sfIdToAWSIdMap);
         }else{
@@ -127,6 +128,7 @@
                 controller.getRecord().put('Contact_Name__c',mso.get('CF00N10000006ps6f_lkid'));
             }
             //鍖婚櫌鍚�
+            System.debug('mso.containsKey(CF00N10000002CvC5_lkid) = '  + mso.containsKey('CF00N10000002CvC5_lkid'));
             if(mso.containsKey('CF00N10000002CvC5_lkid')){
                 controller.getRecord().put('Hospital_Name__c',mso.get('CF00N10000002CvC5_lkid'));
                 //閫氳繃鍖婚櫌id鏌ヨ鎴樼暐绉戝鍒嗙被
@@ -408,6 +410,5 @@
 
     public static Integer ControllerUtil() {
         Integer i = 0;
-        
         return i;}
 }
\ No newline at end of file

--
Gitblit v1.9.1