19626
2023-06-20 9dca2b56fba9e2e3a0346235229e06d9e25fe5fe
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
public with sharing class lexSolutionProjectRequirementsController {
    @AuraEnabled
    public static InitData initSubmitSolutionForApprovalButton(String recordId){
        InitData res = new InitData();
        try {
            SolutionProjectRequirements__c so = [
                select
                Status__c,
                Submit_Date_YouWant__c,
                CreatedDate,
                Department_Class__r.Id,
                Product_Leader__c
                from SolutionProjectRequirements__c where Id =: recordId
            ];
            res.status = so.Status__c;
            res.submitDateYouWant = so.Submit_Date_YouWant__c;
            res.createdDate = so.CreatedDate;
            res.departmentClassId = so.Department_Class__r.Id;
            res.productLeader = so.Product_Leader__c;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
 
    @AuraEnabled
    public static string updateSubmitSolutionForApprovalButton(String recordId){
        SolutionProjectRequirements__c so = new SolutionProjectRequirements__c();
        try {
            so.Id = recordId;
            so.Submint_TF__c = true;
            so.Submitter__c = UserInfo.getUserId();
            update so;
            return '';
        } catch (Exception e) {
            return e.getMessage();
        }
    }
 
    @AuraEnabled
    public static List<Account> queryForAttachments(String Id){
        List<Account> accList = null;
        try {
            accList = [
                select id,
                Department_Class__r.OwnerId,
                Department_Class__r.Owner.SalesManager__c 
                from Account where id =: Id
            ];
            
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return accList;
    }
    class InitData{
        @AuraEnabled
        public String status;
        @AuraEnabled
        public Date submitDateYouWant;
        @AuraEnabled
        public Datetime createdDate;
        @AuraEnabled
        public String departmentClassId;
        @AuraEnabled
        public String userId;
        @AuraEnabled
        public String userName;
        @AuraEnabled
        public String productLeader;
    }
}