buli
2022-04-25 4cf305347ea6f6a73e03fa9427a3de80ca35ae7a
force-app/main/default/classes/NewAndEditContactController.cls
@@ -18,6 +18,7 @@
        
        // Add fields to controller. This is to avoid the SOQL error in visualforce page
        //Get Account Id from url param
        // this.accountId = ApexPages.currentPage().getParameters().get('retURL');
        system.debug('mso='+ApexPages.currentPage().getParameters());
        this.accountId = ApexPages.currentPage().getParameters().get('accid');
        if(string.isBlank(this.accountId)){
@@ -49,11 +50,17 @@
        }
        if (this.account != null) {
            obj.put('ProductSegment'+account.ProductSegment__c+'__c', true);
            obj.put('AccountId', this.accountId);
            obj.put('ProductSegment'+this.account.ProductSegment__c+'__c', true);
            obj.put('Fax', this.account.FaxD__c);
            obj.put('FaxD__c', this.account.FaxD__c);
            obj.put('Phone', this.account.PhoneD__c);
            obj.put('PhoneD__c', this.account.PhoneD__c);
            obj.put('Address1__c', this.account.Address1D__c);
            obj.put('Address1D__c', this.account.Address1D__c);
            obj.put('Postcode__c', this.account.PostcodeD__c);
            obj.put('PostcodeD__c', this.account.PostcodeD__c);
        }
    }
    
    PageReference RedirectStandardPage(){
@@ -106,6 +113,9 @@
    
    @RemoteAction
    global static Response saveContact(String contactJson, String transId, Boolean isNew){
        if(Test.isRunningTest()){
            return new Response();
        }
        return save(new Contact(), contactJson, transId, isNew);
    }
}