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
Daemyian WatsonDaemyian Watson 

Copy Mailing Address to Service Address


I created two sets of custom fields on my Leads Tab. One for Mailing Address and the other for Service Address. I'm trying to create a link on the page layout that would allow users to automatically copy the Mailing Address to the Service Address if they are they save. I saw this on the Contacts Tab in the Developer Edition and I would love to do the same in my org. I looked around in the Developer Edition to see if I could locate the code but I couldn't find it. Does anyone know how to code this? If so, I would really appreciate your help.




Puneet SardanaPuneet Sardana

You can use javascript to accomplish this. On click of that link find copy mailing address input by id and then copy its content to service address.

Daemyian WatsonDaemyian Watson
Hi Puneet,
Thanks for your reply. Where in Salesforce would I have to add the javascript to do this. Any reference material available that I can check out?


Daemyian Watson
Assistant Systems Analyst
Information Systems
Central Hudson Gas & Electric Corp.
284 South Avenue, Poughkeepsie, NY 12601
(845) 486-5792

This message contains confidential information and is only for the intended recipient. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please notify the sender immediately by replying to this note and deleting all copies and attachments. Thank you.
Puneet SardanaPuneet Sardana

Hi ,


You need to call a javascript function on onclick eventr of your link. In that javascript fuction, find the mailing address using document.getElementbyId (give mailing address some id). After that copy its contents to Service address( find this also using document.getElementbyId). If you still not able to understand I will post a code snippet for you. Let me know.