| | |
| | | public Boolean isNewMode{set;get;} |
| | | public String rtTypeId {get; set;} |
| | | public String AWSDataId{set;get;} |
| | | public String AWSDataIdInquiryForm{set;get;} |
| | | public String contactId{set;get;}//For Lookup field |
| | | public List<String> encryptedAPIList{set;get;} |
| | | public String staticResource {get; set;} |
| | | public String staticResourceContact {get; set;} |
| | | public String staticResourceInquiryForm{get; set;} |
| | | public String requiredFieldAPIListStr {get; set;} |
| | | public String fieldAPIToLabelMapStr {get; set;} |
| | | public String Input_Required_Field_Msg{set;get;} |
| | |
| | | public String sobjectPrefix{set;get;} |
| | | public String sobjecttypeForFrontEnd{set;get;} |
| | | public String contactsInfo {set;get;}//key sfid;value awsid |
| | | public Inquiry_form__c ifc{get; private set;} |
| | | public String contactDataId{get; set;} |
| | | public String layoutSectionsStr {get; set;} |
| | | public String isQueryContact{get; set;} |
| | | public NewAndEditLeadController(ApexPages.StandardController controller) { |
| | | isQueryContact = '0'; |
| | | isNewMode = true; |
| | | Input_Required_Field_Msg = Label.Input_Required_Field_Msg; |
| | | PIPL_Name_Label = Label.PIPL_Name_Label; |
| | |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Lead').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | SObject obj = controller.getRecord(); |
| | | if(obj.Id != null){ |
| | | SObject obj = controller.getRecord(); |
| | | |
| | | if(ApexPages.currentPage().getParameters().get('CF00N1000000962np_lkid') != null){ |
| | | System.debug('CF00N1000000962np_lkid'); |
| | | //产品咨询单过来的 |
| | | String InquiryFormId = ApexPages.currentPage().getParameters().get('CF00N1000000962np_lkid'); |
| | | ifc = [select Id,AWS_Data_Id__c,Contact_Name__c,Contact_Id__c,Hospital_Name__c,Hospital_ID__c,Department_Class__c,Department_ID__c,Opp_Name_Search__c,Opp_Name_Search_ID__c,Campaign__c, |
| | | Campaign_ID__c,Name,Cancel_Reason__c,Phone__c,Email__c,Last_Name__c,LeadSource__c,Opportunity_Division__c,Request1__c, |
| | | Urgent__c from Inquiry_form__c where id = :InquiryFormId]; |
| | | Contact c = [select AWS_Data_Id__c from Contact where id = :ifc.Contact_Id__c]; |
| | | contactDataId = c.AWS_Data_Id__c; |
| | | AWSDataIdInquiryForm = ifc.AWS_Data_Id__c; |
| | | System.debug('ifc = ' + ifc); |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | }else if(obj.Id != null){ |
| | | //更新 |
| | | isNewMode = false; |
| | | Lead leadData = [select Id,RecordTypeId,AWS_Data_Id__c,Contact_Name__r.Id,Contact_Name__r.AWS_Data_Id__c from Lead where id =: obj.Id]; |
| | |
| | | sfIdToAWSIdMap.put(String.valueof(leadData.Contact_Name__r.Id).subString(0,15),leadData.Contact_Name__r.AWS_Data_Id__c); |
| | | } |
| | | contactsInfo = JSON.serialize(sfIdToAWSIdMap); |
| | | }else if(ApexPages.currentPage().getParameters().get('CF00N10000006ps6f_lkid') != null){ |
| | | //联系人过来的点击新建意向 |
| | | isQueryContact = '1'; |
| | | String contactId = ApexPages.currentPage().getParameters().get('CF00N10000006ps6f_lkid'); |
| | | Lead leadData = [select Id,RecordTypeId,AWS_Data_Id__c,Contact_Name__r.Id,Contact_Name__r.AWS_Data_Id__c from Lead where id =:contactId]; |
| | | Map<String,String> sfIdToAWSIdMap = new Map<String,String>(); |
| | | if(leadData.Contact_Name__r.Id != null){ |
| | | sfIdToAWSIdMap.put(String.valueof(leadData.Contact_Name__r.Id).subString(0,15),leadData.Contact_Name__r.AWS_Data_Id__c); |
| | | } |
| | | contactsInfo = JSON.serialize(sfIdToAWSIdMap); |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | }else{ |
| | | //新建 |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | |
| | | PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Lead'); |
| | | staticResource = JSON.serialize(piIntegration); |
| | | staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact')); |
| | | staticResourceInquiryForm = JSON.serialize(PIHelper.getPIIntegrationInfo('Inquiry_form__c')); |
| | | encryptedAPIList = piIntegration.PIFields; |
| | | sobjectPrefix = piIntegration.sobjectPrefix; |
| | | layoutSectionsStr = JSON.serialize(layoutSections); |
| | | } |
| | | |
| | | global class Response{ |