+ Start a Discussion
Vijay RautVijay Raut 

Getting Dependant Picklist values

Hi ,
 
In my account i am baving two cutome fields as picklist (like Market and Segment).
Segment is dependant on the Maket.
I have used the DescribeSObject function, which returns me the all picklistvalues for Market and Segment.
But i want to get only those values of Segment which are available for selected Market in my SControl page.
 
So is there any way to find out how to get dependant picklist values according controlling picklist value selected.
 
If anyone having clue about same then please reply to this post.
 
Thanks in Advance.
Vijay RautVijay Raut
Hi ,
I know there is some relation between that validFor property of Picklistvalues and Dependant picklist.
There is exist the validFor property for every picklist value of picklist.
 
But i am not getting that validFor value from the picklist values.
It is giving null value for validFor.
SuchitraSuchitra

I too want to know te solution for this. As Vijay says there is a "validfor" property that is set for each item in the depedent list. The "validfor" is common for a group of dependants

eg.

Category is a pick list that is dependant on family another pick list

Family

Family 1, Family2

Category

Cat1,Cat2,Cat3,Cat4 

 

Now Cat1,Cat2 fall under Family1

Cat3,Cat4 fall under Family2  

 

Now Cat1 and Cat2 have some prop called validfor = qAAA

simillarly

Cat3 and Cat4    have validfor = iAAA

Would want to know how qAAA is related to Family1 or iAAA related to Family2?

 

Thanks in advance

Suchitra

 

 

sfdcfoxsfdcfox
The answers you seek are found here.

~ sfdcfox ~
Vijay RautVijay Raut

Hi Suchitra,

I had same problem and found out simple solution for dependant picklist.

Just include the picklist.js file in javascript source.

And give ID for tag in HTML section of SControl as the field id in the SFDC. like following

<SELECT id="00N300000014Qwh" title="Operator 3" style="WIDTH: 123px" name="00N300000014Qwh">

<OPTION value="" selected>--None--</OPTION>

</SELECT>

<script>new picklist('00N300000014Qwh','00N300000014Qwh','00N300000014Qwc',['',''],' id="00N300000014Qwh" name="00N300000014Qwh" tabindex="16"',true,true);

</script>

Third parameter to picklist gets sfdc id of the controlling field.

Regards

Vijay Raut

BillHansonBillHanson
Hi Vijay,

Thanks for posting the info about picklist.js.  I'm trying to accomplish the same thing, but I'm still running into problems.

I've tried using both the beta tool kit (sforceclient.js) and the version 10 tool kit (connection.js).
I've tried using the picklist.js found at "/js/picklist.js" and the one at "/static/031907/js/picklist.js" (although they appear to be identical).

Still no luck.  Am I missing something?
One difference may be the way I'm building the page.  I'm constructing an html string, then setting that to a div tag's innerHtml.  Everything works except the picklist fields.

Here's a line from my main loop that builds the html table containing all OpportunityLineItems for a given Opportunity.
gLineItemTableHtml += "<td><select id=\"" + recordFieldName + "\" name=\"" + recordFieldName + "\" onchange><option value=\"" + fieldValue + "\" selected>" + fieldValue + "</option></select><script>new picklist('" + recordFieldName + gOpportunityId + "','" + recordFieldName + "',null,['" + fieldValue + "','" + fieldValue + "'],' id=\"" + recordFieldName + "\" name=\"" + recordFieldName + "\"',true,true);</script></td>";