public with sharing class lexNewOpportunityController { public lexNewOpportunityController() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new InitData(); try { // String i=Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE).getRecordTypeId(); List r=[SELECT Id from recordType where name='引合']; res.recordTypeId=r.get(0).Id; List accl=[SELECT Hospital__c,Department_Class__c,Department_Class_Wd__c,OCM_man_province_HP__c from Account where id=:recordId]; res.hospitalC=accl.get(0).Hospital__c; res.departmentClassC=accl.get(0).Department_Class__c; res.departmentClassWdC=accl.get(0).Department_Class_Wd__c; String userId=UserInfo.getUserId(); List ul=[SELECT Province_Text__c from user where id=:userId]; res.provinceTextC=ul.get(0).Province_Text__c; res.OCMManProvinceHPC=accl.get(0).OCM_man_province_HP__c; return res; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } public class InitData{ @AuraEnabled public String recordTypeId; @AuraEnabled public String recordTypeId2; @AuraEnabled public String hospitalC; @AuraEnabled public String departmentClassC; @AuraEnabled public String departmentClassWdC; @AuraEnabled public String provinceTextC; @AuraEnabled public String OCMManProvinceHPC; } }