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
public with sharing class NewAgencyContractController {
    
    @AuraEnabled
    public static UserResult UserInfo_Owner() {
        UserResult result = new UserResult();
        ID myUserID = UserInfo.getUserId();
        Profile p = [select Id,Name from Profile where id =:System.Label.ProfileId_SystemAdmin];
        try { 
            User tempUser = [select Id,Name,ProfileId from user where id = : myUserID ];
            result.id = tempUser.Name;
            result.recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('AgencyContract').getRecordTypeId();
            result.profileId = p.Name;
        } catch (exception e) {
            result.result = e.getMessage();
        }
        return result;
    }
 
    public class UserResult {
        @AuraEnabled
        public string result;
        public UserResult( ) {
            result = 'Success';
        }
        @AuraEnabled
        public string id;
        @AuraEnabled
        public String recordTypeId;
        @AuraEnabled
        public string profileId;
    }
}