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
VNVN 

Populating a custom field

Hi All,
 
I have a requirement which is almost the same as a standard functionality in SFDC.In the Contact object page,while creating a new contact,on choosing an Account,it is seen that the Mailing street and mailing City fields are automatically populated without the user typing it.
 
I have the same requirement but on a different object.
Can anyone help me to find the solution?
 
Thanks in advance,
VN
jpizzalajpizzala
It sounds like you should be able to solve this using Apex pretty easily. There is currently a thread on the Apex Code Development discussion board that may help you out:

http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=1483

Also, check out the Apex Guide here:

http://www.salesforce.com/us/developer/docs/apexcode/index.htm

And the Visualforce/Apex Wiki:

http://wiki.apexdevnet.com/index.php/Apex_and_Visualforce

HTH
RickyGRickyG
VN -

Also, you should consider whether you really want to copy the data over to the new object.  This approach will work fine if you want to use those values as defaults - which means a one-time synchronization.

But if you want the new object to always have the current value of mailing street and city from Contacts, you should use a relationship to point back to the original data.  Consider the case where the mailing street changes for the Contact - do you want those changes to be in the new object's record?  What about if the user had changed those values in the new object record?

Duplicating data frequently seems like a good idea, but you should make sure it addresses issues like these.

Hope this helps.

VNVN

Hi Ricky,

Thanks for the reply.

I have written an Scontrol which queries the Account table and fetches the value to autopopulate the custom field.But currently my Scontrol is triggered on click of a button on the Contact page.(ie:On clicking the button,the Scontrol is invoked which opens up Edit mode for the contact,and prepopulate the custom field.)

But i want this to happen when the account information is filled.(ie:When the user enters value for the Account,my Scontrol should get triggered,exactly as the standard functionality in SFDC).

Thanks,

VN