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
ezhil_kezhil_k 

How to create a dynamic list?

I want to create a list for eact pick list value,

Some thing lik this below

Schema.DescribeFieldResult  ob = object__C.Type__c.getDescribe();
     List<Schema.PicklistEntry> ob1 = ob.getPicklistValues();
      for(integer i=0;i<ob1.size();i++){
      string listname=TokenState[i];
       List<Token__C>listname+'list'= new List<Token__C>();
      

This code is errored out.

Please guide me how to proceed?.
        
ShaTShaT
Hi ,

Below is the example to get picklist values of a object.

public List<String> technologies {
    get {
      if (technologies == null) {

        technologies = new List<String>();
        Schema.DescribeFieldResult field = Contact.interested_technologies__c.getDescribe();

        for (Schema.PicklistEntry f : field.getPicklistValues())
          technologies.add(f.getLabel());

      }
      return technologies;         
    }
    set;
  }

Regards
SFDC

ezhil_kezhil_k
Hi,

I want to create a list for each of the pick list  value dynamically