1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
public without sharing class NewLeadFromContact2 {
    @AuraEnabled
    public static InitData NewLeadFromContact2(String recordId) {
        InitData res = new initData();
        try{
            Contact report= [SELECT Id,Name,AccountId,AWS_Data_Id__c FROM Contact WHERE Id = :recordId LIMIT 1]; //2023/08/02 zhj  加上AWS_Data_Id__c字段
            res.Id = report.Id;
            res.Name = report.Name;
            res.AccountId = report.AccountId;
            res.AWSDataId = report.AWS_Data_Id__c;//2023/08/02 zhj 
            Account acc =  [SELECT Id,Name,Department_Class__c  FROM Account WHERE id =: report.AccountId]; 
            res.accountIds = acc.Id;
            res.accountName = acc.Name;
            res.accountDepartmentClass = acc.Department_Class__c;
            res.NewDailyReport = Schema.SObjectType.Lead.getRecordTypeInfosByDeveloperName().get('NewDaily_Report').getRecordTypeId();
            System.debug(LoggingLevel.INFO, '*** xu: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** xu: ' + e);
        }
        return res;
    }
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String Name;
        @AuraEnabled
        public String AccountId;
        @AuraEnabled
        public String accountIds;
        @AuraEnabled
        public String accountName;
        @AuraEnabled
        public String accountDepartmentClass;
        @AuraEnabled
        public String NewDailyReport;
        @AuraEnabled
        public String AWSDataId;//2023/08/02 zhj
    }
}