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
anu2011anu2011 

copy account adress information to custom object address in vf page

hi,

Account-->standard object

Contact -->Standard Object

Address-->Custom object

 

i have a vf page that displays account ,contact informations and a custom object "address".this custom object has 2 record type with separate page layout for  billing and shipping address.(both billing addrress and shipping address have separate section in vf page)

 

i have a command button "COPY"  and a picklist with option BILLING ,SHIPPING  if i select "BILLING"on click of the "cOPY" button in vf page,

standard object ACCOUNT billing Address should copy to visual force page billing address section and save to billing record type after copy it in a vf page.

 

kindly reply me soon .

THANKS IN ADVANCE

bob_buzzardbob_buzzard

In your action method that is invoked when the user hits the copy button, you should be able to make the appropriate changes to the custom object.  

 

I've had a stab at it below - obviously I don't know any of your object/field names, so it will need some tweaking.  copyType is the property that backs the picklist, billingAddr is the instance of your custom object tied to the billing address and account holds the account record.

 

 

public PageReference copyAddress()
{
   Address__c toChange;
   // get the type of copy
   if (copyType=='Billing')
   {
      billingAddr.Street__c=account.Street;
      billingAddr.City__c=account.City;
      // repeat for all address fields
   }

   // refresh the page
   return null;
}

 

 

anu2011anu2011

can you give me some sample code ,i am new to salesforce

bob_buzzardbob_buzzard

I did - see my earlier post.  Are you looking for the full page and controller code?  If so, I'm afraid that's a level of help I don't have time to give.  If you want to have a stab at it, I'll be happy to assist you in the event of problems.