liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public with sharing class SaveMContractFromReportController {
    public String newId { get; private set; }
    
    public void init() {
        String eid = ApexPages.currentPage().getParameters().get('eid');
        newId = ApexPages.currentPage().getParameters().get('newid');
        
        Event__c e = [select Id, Maintenance_Contract_Count__c from Event__c where Id = :eid];
        e.Maintenance_Contract_ID__c = newId;
        if (e.Maintenance_Contract_Count__c == null) {
            e.Maintenance_Contract_Count__c = 1;
        } else {
            e.Maintenance_Contract_Count__c = e.Maintenance_Contract_Count__c + 1;
        }
        update e;
    }
}