Li Jun
2022-03-28 f5a94e721ae5a26f817f0df75065b64f1f192eb3
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
global without sharing class NewAndEditAgencyContactController extends NewAndEditBaseController 
{
    public string staticResourceContact{get;private set;}
    public string staticResourceAWSContact{get;private set;}
    public String awsContactId{set;get;}//From agency contact's contactId
    global NewAndEditAgencyContactController(ApexPages.StandardController controller) {
        List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Agency_Contact__c').getDescribe().fields.getMap().keyset());  
        // Add fields to controller. This is to avoid the SOQL error in visualforce page
        controller.addFields(fieldList);
        LookUpOverrideFields.add('Contact__c');
        Init(controller.getRecord());
        if(controller.getRecord()!=null && controller.getRecord().get('Contact__c')!=null){
            String contactIdValue = (String)controller.getRecord().get('Contact__c');
            List<Contact> conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where id =:contactIdValue]);
            if(conList.size()>0){
                awsContactId = conList[0].AWS_Data_Id__c;
            }
        }
        PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Agency_Contact__c');//Updated By Lijun 20220326
        staticResourceContact = JSON.serialize(piIntegration);
        PIHelper.PIIntegration piConIntegration = PIHelper.getPIIntegrationInfo('Contact');//Updated By Lijun 20220326
        staticResourceAWSContact = JSON.serialize(piConIntegration);
    }
 
    
    @RemoteAction
    global static Response saveContact(String leadJson,String transId,Boolean isNew) {
        return save(new Agency_Contact__c(),leadJson,transId,isNew);
    }
}