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
kalyanasundaramkalyanasundaram 

How to display default value in look up field?

Hi All,

 

 Is there any way to display default value in look up field?

 

Thanks.

 

 KSR

WPCMSWPCMS
I saw this done once. It had something to do with the URL. If anybody can show that again that would be great! I can use this in a lot of places.
ccMarkccMark

It's been a while since I used this, but I hope it helps you here.

 

You can pass in parameters on the URL that will set default values.

 

For instance, if you are creating a new object your URL might look something like this:

 

https://na6.salesforce.com/006/e?retURL=%2F006%2Fo

 

The only parameter here is the return URL.

 

To set the default value, you can view the page source and identify the id of the field you want prepopulated with a value.  One thing I do want to point out is that I don't know how often if ever these ids change, but I did read about this feature over a year ago somewhere in the Salesforce.com help or supporting documentation and it was supported then.

 

To set this up, I use the browser to view source of the page where I want data prepopulated and identify the id of the input field used for my opportunity field:

 

<input  id="opp3" maxlength="120" name="opp3" size="20" tabindex="1" type="text" value="" />

Then, I simply added to the URL:

 

https://na6.salesforce.com/006/e?opp3=test&retURL=%2F006%2Fo

 

Now, when the page opens, the data is prepopulated in the opportunity name field.

 

Hope this helps.

 

Mark

 

 

 

courtneybcourtneyb

Hi Mark,

 

I'm trying to implement your solution and am running into an issue with the URL.  When I go to create a new account, the URL is really long.  

https://na7.salesforce.com/setup/ui/recordtypeselect.jsp?ent=Account&retURL=/001/o&save_new_url=/001/e%3FretURL%3D%252F001%252Fo

 

Am I doing something wrong here?  Wondering why it's not as such as the example you provide above.

 

Thanks,

Courtney