+ Start a Discussion
Nerv123Nerv123 

Trying to Copy Mailing Address to Billing Address

copyAddr('00N50000001NZQN', '00N50000001NZPH', '00N50000001NZQF', '00N50000001NZPz', '00N50000001NZP7', 'acc17street', 'acc17city', 'acc17zip', 'acc17country', 'acc17state', true, true)

I am trying to use the above as a Custom S-Control or a Button, but neither works.

Please help!
TCAdminTCAdmin
Hello Nerv123,

If you are on the Account object you will only need to display the 'Address Information' header in the page layout. There is already a standard link while in the Edit mode that will populate the Shipping with the Billing addresses.

If you want to utilize a custom link type solution you can use the following:

Code:
/{!Account.Id}/e—retURL=/{!Account.Id}&acc18street={!Account.BillingStreet}&acc18city={!Account.BillingCity}&acc18state={!Account.BillingState}&acc18zip={!Account.BillingPostalCode}&acc18country={!Account.BillingCountry}&save=1

This will update the fields, save the record, and leave you on the same page. If you want it to go the other way you will need to change the 18s to 17s and change Billing to Shipping.

Nerv123Nerv123
Thanks for the suggestion.  We have attempted to do as you say.  The new code we inputed is as follows.

/{!Account.Id}/e—retURL=/{!Account.Id}&acc17street={!Account.Mailing_Street__c}&acc17city={!Account.Mailing_City__c}&acc17state={!Account.Mailing_State__c}&acc17zip={!Account.Mailing_Zip__c}&acc17country={!Account.Mailing_Country__c}&save=1

We are still having a few problems.  When we go into the account to test, we get this code back:

/0015000000MkeeZ/e—retURL=/0015000000MkeeZ&acc17street=P.O. Box 606&acc17city=Eagle&acc17state=CO&acc17zip=81631&acc17country=United States&save=1

We would appreciate any suggestions.

Thanks
TCAdminTCAdmin
I see that my code didn't get posted exactly correct. The character after the e '/{!Account.Id}/e' should be a question mark and not a hyphen. it should start at:
 
Code:
/{!Account.Id}/e?retURL=/{!Account.Id}&

 
For some reason it tries to change it even in the code tags. Us a ? instead of - and it should work.