buli
2023-05-24 1a63180b4cabdf8b63e9a93eab8d715a72a01514
commit
2个文件已修改
34 ■■■■■ 已修改文件
force-app/main/default/classes/LayoutDescriberHelper.cls 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NewAndEditLeadController.cls 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
}
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;}
}