Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having 1 lookup field country. i want to set it with some default value on UI. How should i implement this?

share|improve this question
up vote 1 down vote accepted

One of the best solution is to use trigger. Create a insert trigger and set default value through that trigger.

Another solution is to pass the default value in the url. You have to get the id of that field and a URL can be created to set default value.

For eg. if the id of that field is 'country' , then url would be:

A new button can be created and URL on this button can be set to this one.

share|improve this answer
Hi more thing i need to do is to replace lookup with picklist.Plz suggest. – Pankaj Jan 16 '13 at 7:15
Can you please elaborate ? – S.Sharma Jan 16 '13 at 7:27
i have one custom lookup field now i need to show it in the form of picklist in visualforce page. – Pankaj Jan 16 '13 at 7:37
For this , you have to create a Select List on vf page and options of that select list will be the all results of that look-up field. Then you have to use the selected value from drop-down manually and then you can use that field as you want. – S.Sharma Jan 16 '13 at 7:48
Yup.Thanks shankar – Pankaj Jan 16 '13 at 10:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.