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
joe-kizayjoe-kizay 

Dependent picklist values

Ive seen this question posted before with no answer to it. Just wondering if anyone has worked this out. I am trying to display a picklist filtered by the value selected by the parent picklist. Below is the code I am working with. The problem I have is that validFor for a picklistValue is nothing. From what I read in the API, validFor returns some sort of byte array but just looking at the toolkit it seems it is never populated with anything. It is just initialized to a new array (Sforce.PicklistEntry.prototype.validFor = new Array();).
 
Suggestions? Thanks...
 
Code:
 var s = sforceClient.DescribeSObject(sfdcObjName);
 var picklistValArray = new Array();
 var valid4 = null;

 for(var x=1;x<s.fields.length;x++)
 {

  if(s.fields[x].type=="picklist" && s.fields[x].name == colName)
  {
   if(wDepend)
   {
    isDependent = s.fields[x].dependentPicklist;
   }

   var pls = s.fields[x].picklistValues;

   for(var y=0;y<pls.length;y++)
   {
    valid4 = pls[y].validFor; 
    picklistValArray[y] = pls[y].value;
   }
  }
 }

 return picklistValArray;
}