+ Start a Discussion
Ritika JRitika J 

Custom Button + Prepopulate Fields



I have a to create a  custom buston on contact object. On click of this custom button user should be taken to  standard page for creating new user , with some information prepopulated.


Any idea how to achieve this , please help me.


Thanks in advance.




 Yes that can be done you have to run a small javascript code on the click of the custom button.


say on click of the custom button you run the following code:-


lets assume the link for user creation is as follows:-



window.parent.location = "https://na4.salesforce.com/005/e?name_firstName=yuyu&retURL=%2F005%3FretURL%3D%252Fui%252Fsetup%252FSetup%253Fsetupid%253DUsers%26setupid%3DManageUsers";

in the above link if one check the source code of User creation page the textbox for first name's id = name_firstName so in the link I have set it to "uuuuuuu" so when the link is followed the new user creation page is opened with first name prepopulated with "uuuuu".

Use your own salesforce instance url.

Hope this helps

Ritika JRitika J

Hi Ispita ,


Thanks for replying


Please tell me the signnificance of retURL.

Do i need to change anything while deploying this button from one instance to another.






Good question . Are you using managed package by any chance.

I think you need to check that the id of the checkbox is same in the org where you will deploy , if its different you need to change the id as its there in the deployed org.

Also retURL basically tells the page where to return after the case has been created.


Hope this answers your query.....