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
Nilesh ManeNilesh Mane 

URGENT : Prepopulate values for custom fields on standard Contact edit page.



I want to prepopulate values for Custom field of Contact object. When user clicks on "New Contact" button from Account screen some values from account record should get prepopulated in new contact edit page. I need Id of custom fields on Standard Contact Edit Page through Apex. How to get that id? I can set values for fields once i get its id.


Please help.




If you want to pre populate the some values of Account object in custom field of contact  when creating a new contact .You have to override the new contact button with VF page with custom controller(Apex class)

Nilesh ManeNilesh Mane

  p.getParameters().put('00NJ0000000GEs9',conAccount.Region__c);  //region


i am using a vf alon with its controller...

My problem is want to prepopulate values for custom fields.

Currently i am able prepopulate values by hardcoding the field id's. I want to do it dynamically.

for example : In above line i m able toprepopulate Region__c value from Account's Region__c  to Contact's Region__c by hardcoding its id. I do not want to hard code anythig.

How to get that id using Apex?






We were also having same need, but later found that we cannot get the field ids dynamically.



Ritesh AswaneyRitesh Aswaney

Using standard Salesforce edit pages, screenscraping, i.e. passing id=values is your only option.


If you're okay with a custom vf contact edit page, you could pass in the Account Id, the controller of your edit page can query the Account and pre-populate the values displayed on your vf pages with values from the account.