Copying info on a one off basis from a related table based on related ID
Apologies if this has been posted before and I have not found it. I am not clear which script function to use to make this an easy task. Here is what I am trying to achieve:
I have a Table that stores customer address info at the generic account level - Company name, shipping address and billing address. I also have a contacts table which has the contact name, Account (looked up from the Account Table to make sure spelling is correct) and here I want to have the option to pull the address from the Account table or enter myself.
A script runs which performs the lookup of the Account Name, and then sets a field within the Contacts table called "account_ID".
I want to put a button next to the contact address fields which would then perform a script that would copy the fields from the related record in the Account Table to the Contacts table based upon the Account_ID.
As I said, I am not sure on the best script function to use to perform this - is it a case of using temporary variables on the script that get the record content from the account table and then commit this to the Contact fields. If this is the way to go (which is how I started), I need to make sure that the correct account info is used as this may not be the last account showing.
Any guidance on the way of doing this would be appreciated.