liangxiaozhen
2023-08-11 af908216bb0012fe849e3b49b3039c7ba238f8f0
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
public with sharing class AccountUrlRecordTypeIdController {
    @AuraEnabled
    public static string CreateAccountGYN(){
        return Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Department_Class_GYN').getRecordTypeId();
    }
    @AuraEnabled
    public static string ReportId(String TypeName){
        try {
            String reportId = [select Id from Report where DeveloperName = :TypeName].Id;
            return reportId;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    @AuraEnabled
    public static RepairContactData RepairContact(String recordId){
        RepairContactData result = new RepairContactData();
        try {
            Account report = [select Department_Class_Label__c from Account where Id = :recordId];
            result.departmentClassLabel = report.Department_Class_Label__c;
            result.typeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('AgencyContact').getRecordTypeId();
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return result;
    }
    public class RepairContactData{
        @AuraEnabled
        public string typeId;
        @AuraEnabled
        public string departmentClassLabel;
    }
}