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
Juan RomeroJuan Romero 

Displaying Picklist based on another field's value

Hey guys,

I was wondering if there is a way to make some selections available to users depending on the value they select for another field....

For instance, let's say I am creating a new lead, and I select value "x" in my "Lead Source" picklist field. I would like to be able to change the contents of the "Lead Source Detail" picklist, to display options relevant to value "x".

Can this be done in Salesforce? Is there a way of customizing it to do that?

Thank you in advance.

adamgadamg
I know this is something that has been on the roadmap, but is currently not available today. If there is any information on scheduled availability we'll let you know.
SteveSteve

It's not an ideal solution but, you can do it using an scontrol. You load the salesforce page into an iframe and then setup the relationships and events to make the picklists dependent with some javascript.

I just set up some dependent picklists with the help of Matt Kruse's dynamic option list script.

http://www.mattkruse.com/javascript/dynamicoptionlist/

slowly slowlyslowly slowly
Steve,

I'm new to this so excuse me if my questions are a bit basic. Are you saying that you have a web tab that has an scontrol in it, where the scontrol is made up off at least two iframes. One iframe has your javascript that has dependant dropdowns and the other iframe has a salesforce tab it it?

Do the two iframes interact? Via merge fields?

Regards,
Anthony.
SteveSteve

Hi Anthony,

Yes, you can have a web tab and can set the tab type to sControl. As an example using cases, the scontrol can have the following html body:

<_body>

<_IFRAME id=testiframe name=testiframe marginWidth=0 marginHeight=0 src="/500/e" frameBorder=0 width="100%" scrolling=no onload="this.height = this.Document.body.scrollHeight;this.width= this.Document.body.scrollWidth;setup();" height="100%"/>


<_SCRIPT>
function setup() {

frames['testiframe'].document.forms['editPage']['PICKLISTFIELDNAMExxx'].value='test';
}


As you can see, you can reference the form values using javascript. Using this technique you can make dependent picklists or calculated controls.


-Steve

slowly slowlyslowly slowly
Thanks Steve,

I don't suppose there's a way to target just the "content" part of the salesforce screen? I suspect the answer is no and you're always going to be stuck with two layers headers.

Regards,
Anthony.