• Nida Shaikh 40
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
public class wrapperClassController {
    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value
    public class lntypes {
        public License_Numbers__c con {get; set;}
        public Boolean tobeEdited {get; set;}

        //This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
        public lntypes(License_Numbers__c c) {
            con = c;
            tobeEdited = false;
        }
    }
        
    //Our collection of the class/wrapper objects cContact
    public List<lntypes> licList {get; set;}

    //This method uses a simple SOQL query to return a List of Contacts
    public List<lntypes> getLicenseList17() {
        if(licList == null) {
            licList = new List<lntypes>();
            for(License_Numbers__c c:[select id, Name, X2016_Cost__c, Business_Unit__c, X2016_Starting_Amount__c, X2016_Subtotal__c, BMS_Code__c, License_Type__c, Monthly_Unit_Price__c, Org__c FROM License_Numbers__c ]) {

                // As each contact is processed we create a new cContact object and add it to the contactList
                licList.add(new lntypes(c));
            }
        }
        return licList;
    }
    public PageReference saveRecord() {

        //We create a new list of Contacts that we be populated only with Contacts if they are selected
        List<License_Numbers__c> selectedTypes = new List<License_Numbers__c>();

        //We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
        for(lntypes cCon: getLicenseList17()) {
            if(cCon.tobeEdited == true) {
                selectedTypes.add(cCon.con);
            }
        }

        // Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
        System.debug('These are the selected Contacts...');
        for(License_Numbers__c con: selectedTypes) {
            system.debug(con);
        }
        contactList=null; // we need this line if we performed a write operation  because getContacts gets a fresh list now
        return null;
    }

    
}
I have a wrapper class that is suppose to loop through some license records and then if one is edited to update it.  

Just copying the wrapper class from SFCD and changing the variable to match what I need I'm getting a unexpected token 'class'  at line 70 column 11

Line 70
public class lntypes {

What is my problem?
 
  • September 21, 2016
  • Like
  • 0