+ Start a Discussion
RaavipatiRaavipati 

to prepopulate a field in the account object

Hi,
I have custom lookup field in a account object 
lookup to the user

My question is i have to prepopulate the field with the user name that means owner of the account

please help me to sort out this

Thanks & Regards
Pratyusha.K
LBKLBK
You mean auto-populate this field?

You can do that using a trigger, workflow rule or a Process (Process Builder).

You can just populate your field with Owner field in the Account object.
RaavipatiRaavipati
Thank you
But these things happen after saving the record
but i want at the time of filling the fields in the account object
Amit Singh 1Amit Singh 1
For this, you can create a hierarchical custom setting and store Org-wide default value for that field which will populate that value in the lookup field.

For more info refer below links:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_custom_settings.htm

http://blog.jeffdouglas.com/2010/02/08/using-hierarchy-custom-settings-in-salesforce-com/

Thanks!
Surendra Choudhary 1Surendra Choudhary 1

Hi Pratyusha,

You need to create a vf page with standard controller as "Account" and extension and pre-populate it on vf page load.

Bind this page on standard  new button of Account object.

Regards,

Surendra

Vivian Charlie 1208Vivian Charlie 1208

HI Raavipati,

 

You can do this using a custom button or override the standard button with a VF and url hack the parameters

A similar post was made earlier by another member the solution to which I have provided

https://developer.salesforce.com/forums/ForumsMain?id=9060G000000IBJN

 

The same key-value parameters must be set in the redirection url of your visualforce page to auto-populate field values

 

Thanks

Vivian