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

Extension Help



I am trying to write an extension on custom object Zip_Code__c where the extension pulls all records from custom object Release__c if Zip_Code__c.Name = Release__c.Zip__c


Below is my code, I cannot figure this out...thoughts?


public class ZipCode {
         //private final Video_Release__c releases; 
         private List<Video_Release__c> releases = new List<Video_Release__c>(); 
         public ZipCode(Apexpages.StandardController controller)
         {String zip = controller.addFields(List<String> Name);
         releases =  [Select ID, RecordTypeID, Platform__c, Name, Released__c, Last_Swept__c, Current_Penetration__c, Video_Qualified_Addresses__c
                      From Video_Release__c
                      Where Zip__c = :zip
                      ORDER BY Name]; }
         public List<Video_Release__c> getreleases() { return releases; } 
         public PageReference save() { update releases; return null; } }


I am getting error Unexpected Token List at Line 6





Best Answer chosen by Admin (Salesforce Developers) 

Well problem seems to be in this line
String zip = controller.addFields(List<String> Name)

you doesnt seem to be initialising the list properly it should be

controller.addFields(new List<String>{'Name'})

Zip_Code__c zipCode = (Zip_Code__c)controller.getRecord();

String zip = zipCode.Name;