/*
|
* Created Date: 07/04/2022
|
* Purpose: Utility class for describe layouts
|
* Test Class: NewAndEditAgencyOpportunityController
|
* History:
|
* 07/04/2022 - Yanan Chen - Initial Code.
|
*
|
* */
|
global class NewAndEditAgencyOpportunityController extends NewAndEditBaseController{
|
public String agencyContactAWSId{set;get;}
|
public String staticAgencyContactResources {get; set;}
|
public NewAndEditAgencyOpportunityController (ApexPages.StandardController controller) {
|
|
List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Agency_Opportunity__c').getDescribe().fields.getMap().keyset());
|
// Add fields to controller. This is to avoid the SOQL error in visualforce page
|
if (!Test.isRunningTest()) {
|
controller.addFields(fieldList);
|
}
|
// Init(controller.getRecord());
|
|
SObject obj = controller.getRecord();
|
//1. get 访问对象ID
|
//query event by controller.getRecord().Id;
|
if(obj.Id != null){
|
Agency_Opportunity__c ao = [SELECT Id, Agency_Contact__c FROM Agency_Opportunity__c WHERE Id =:obj.Id];
|
System.debug('ao: ' + ao);
|
if(ao != null){
|
List<Agency_Contact__c> ac = [select AWS_Data_Id__c,Name from Agency_Contact__c where id=:ao.Agency_Contact__c];
|
if(ac.size()>0){
|
if (ac[0].AWS_Data_Id__c != null && ac[0].AWS_Data_Id__c != '') {
|
agencyContactAWSId = ac[0].AWS_Data_Id__c;
|
}
|
}
|
} else {
|
agencyContactAWSId = '无';
|
}
|
}
|
staticAgencyContactResources = JSON.serialize(PIHelper.getPIIntegrationInfo('Agency_Contact__c'));
|
}
|
}
|