function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
uday kumar yuday kumar y 

How to copy current address as same permanent address when check box is checked it will be copied and automatically save the record by using controller

AvaneeshAvaneesh
Hi Uday 
can you explain briefly about your requirement what u need
trigger
process builder 
or something else let me know complete 

thank you 
Avaneesh Singh
 
uday kumar yuday kumar y
i need to bulid  on visualforce 
AvaneeshAvaneesh
Hi Uday 

Show me your code where u are stuck ..Let me know 
I will resolve it 

 
Rakesh Thota 15Rakesh Thota 15
Hi Uday,

Please refer the below link for your requirement.
https://developer.salesforce.com/forums/?id=906F0000000DCXv

Hope this link will help you to fix your issue. make it solved if its works for you. 

Best Regards,
Rakesh Thota.

 
Arun Mathew 22Arun Mathew 22
Hi,  You can refer the below code change according to your need. Below code copies the billing address to Shipping address if the checkbox is checked.
<apex:page standardController="Account" extensions="BillingAndShippingAddress">
    <apex:form>
        <apex:pageBlock title="Create Account" >
            <apex:pageMessages />
            
            <apex:outputPanel id="Basics" >
                <apex:pageBlockSection title="Basic details" >
                    <apex:inputField value="{!Account.name}" />
                    <apex:inputField value="{!Account.Phone}" />
                    <apex:inputField value="{!Account.Industry}" />
                    <apex:inputField value="{!Account.Annualrevenue}" />
                </apex:pageBlockSection>
            </apex:outputPanel>
            
            <apex:outputPanel>
                <apex:pageBlockSection title="Billing Address" >
                    <apex:inputField value="{!Account.BillingStreet}" />
                    <apex:inputField value="{!Account.BillingCity}" />
                    <apex:inputField value="{!Account.BillingState}" />
                    <apex:inputField value="{!Account.BillingCountry}" />
                    <apex:inputField value="{!Account.BillingPostalCode}" />
                    
                </apex:pageBlockSection>
            </apex:outputPanel>
            <apex:pageBlockSection id="Question">
                <apex:outputLabel>Is Shipping Address same as Billing Address?</apex:outputLabel>
                <apex:inputCheckbox value="{!isBASameAsSA}">
                    <apex:actionSupport  event="onclick" reRender="SA,Basics" action="{!copyAddress}" />
                </apex:inputCheckbox>
            </apex:pageBlockSection>
            <apex:outputPanel>
                <apex:pageBlockSection title="Shipping Address" id="SA"  >
                    <apex:inputField value="{!Account.ShippingStreet}" />
                    <apex:inputField value="{!Account.ShippingCity}" />
                    <apex:inputField value="{!Account.ShippingState}" />
                    <apex:inputField value="{!Account.ShippingCountry}" />
                    <apex:inputField value="{!Account.ShippingPostalCode}" />
                </apex:pageBlockSection>
            </apex:outputPanel>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" />
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>
public class BillingAndShippingAddress {
    public boolean isBASameAsSA{ get; set;}
    public Account act{ get; set;}
    public BillingAndShippingAddress(ApexPages.StandardController controller) {
        isBASameAsSA=false;
        act=(Account)controller.getRecord();
    }
    public pageReference copyAddress() {
        If(isBASameAsSA==true){
            act.ShippingStreet=act.BillingStreet;
            act.ShippingCity=act.BillingCity;
            act.ShippingCountry=act.BillingCountry;
            act.ShippingState=act.BillingState;
            act.ShippingPostalCode=act.BillingPostalCode;
        }
        else{
        	act.ShippingStreet='';
            act.ShippingCity='';
            act.ShippingCountry='';
            act.ShippingState='';
            act.ShippingPostalCode='';
        }
        return null;
    }
}