• Julianne Tajuba
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
List of Apex Test Failures
So I've run into some issues that I've not seen before as I attempt to move an updated visualforce page and apex class out of the sandbox and into production. I'm not sure what the CTLR_VolunteerAppliationTest is referring to, so I'm not sure where to start to fix this problem. The second set of failures regarding System.DmlException: Insert failed. don't make sense as the class names listed: Paypal_Autherization and below aren't even included anywhere on the visualforce page or apex class I am attempting to move. Any pointers for a newbie to apex testing and visualforce development would be greatly appreciated.

For Reference Apex Class Code:

public with sharing class CTLR_VolunteerApplication_Updates {
    public final ApexPages.StandardController controller;
    public Account account { get; set;}
    
    public CTLR_VolunteerApplication_Updates(ApexPages.StandardController controller) {
        this.controller = controller;
        this.account = (Account)controller.getRecord();
        
    }
      
    public String salutation {get; set;}
    public String fname {get; set;}
    public String lname {get; set;}  
    
    //get the multi-select pick list values
    public List<SelectOption> MPOptions {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult volunteerAvail = Schema.Account.GW_Volunteers__Volunteer_Availability__pc.getDescribe();
         
       List<Schema.PicklistEntry> f = volunteerAvail.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }
    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.GW_Volunteers__Volunteer_Availability__pc !=null && this.account.GW_Volunteers__Volunteer_Availability__pc.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.GW_Volunteers__Volunteer_Availability__pc = selectedCheckBox;
     }
   } 
    
    
    //get the multi-select pick list values
    public List<SelectOption> MPOptions2 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult volunteerInterests = Schema.Account.GW_Volunteers__Volunteer_Skills__pc.getDescribe();
         
       List<Schema.PicklistEntry> f = volunteerInterests.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }
    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems2 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.GW_Volunteers__Volunteer_Skills__pc !=null && this.account.GW_Volunteers__Volunteer_Skills__pc.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.GW_Volunteers__Volunteer_Skills__pc = selectedCheckBox;
     }
   } 
    
//get the multi-select pick list values
    public List<SelectOption> MPOptions3 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult SpecialSkills = Schema.account.Special_Skills__c.getDescribe();  
     
       List<Schema.PicklistEntry> f = SpecialSkills.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }

    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems3 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.Special_Skills__c !=null && this.account.Special_Skills__c.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.Special_Skills__c = selectedCheckBox;
     }
   } 
   
    public PageReference submit() {
      integer count = 0;
      count = [SELECT count() FROM Account WHERE FirstName = :account.FirstName AND LastName = :account.LastName ];
      System.debug('count' + count);
      
      if ( count == 0 )    {
      
          if (account.Terms_Conditions_Accepted__pc)  {
              try{
                    RecordType personAccountRecordType =  [SELECT Id FROM RecordType WHERE Name = 'Person Account' and SObjectType = 'Account'];
                    account.RecordType = personAccountRecordType;
                    account.Salutation = salutation;
                    account.FirstName = fname;
                    account.LastName = lname;
                    account.Contact_Email__c = account.PersonEmail;
                    account.Volunteer_Application_Submitted__c = true;
                    if ( [ SELECT count() FROM Account WHERE PersonEmail = :account.PersonEmail ] > 0 )
                      {
                       
                       Account a = [SELECT    Id,
                                              Salutation,
                                              FirstName,
                                              LastName,
                                              Contact_Email__c, 
                                              Volunteer_Application_Submitted__c,   
                                              PersonMailingStreet, 
                                              PersonMailingState,
                                              PersonMailingCity,
                                              PersonMailingPostalCode,
                                              PersonHomePhone,
                                              Phone,
                                              PersonEmail,
                                              Allergies_and_or_Restrictions__pc,
                                              How_did_you_hear_about_us__pc,
                                              Current_Occupation__pc,
                                              GW_Volunteers__Volunteer_Availability__pc,
                                              GW_Volunteers__Volunteer_Skills__pc,
                                              Special_Skills__c,
                                              Experience_Level_With_Cats__c,
                                              Experience_Level_with_Dogs__c,         
                                              Emergency_Contact_Name__pc,
                                              Emergency_Contact_Home_Phone__pc,
                                              Emergency_Contact_Work_Phone__pc,
                                              Emergency_Contact_Email__pc,
                                              Terms_Conditions_Accepted__pc,
                                              Age_Checkbox__c
                                           FROM Account
                                           WHERE PersonEmail = :account.PersonEmail OR Contact_Email__c = :account.PersonEmail LIMIT 1] ;
                       a.RecordType = personAccountRecordType;
                       a.Salutation = salutation;
                       a.FirstName = fname;
                       a.LastName = lname;
                       a.Contact_Email__c = account.PersonEmail;
                       a.PersonEmail = account.PersonEmail;
                       a.Volunteer_Application_Submitted__c = true;
                       a.PersonMailingStreet = account.PersonMailingStreet;
                       a.PersonMailingState  = account.PersonMailingState;
                       a.PersonMailingCity = account.PersonMailingCity;
                       a.PersonMailingPostalCode = account.PersonMailingPostalCode;
                       a.PersonHomePhone = account.PersonHomePhone;
                       a.Phone = account.Phone;
                       a.Allergies_and_or_Restrictions__pc = account.Allergies_and_or_Restrictions__pc;
                       a.How_did_you_hear_about_us__pc = account.How_did_you_hear_about_us__pc;
                       a.Current_Occupation__pc = account.Current_Occupation__pc;
                       a.GW_Volunteers__Volunteer_Availability__pc = account.GW_Volunteers__Volunteer_Availability__pc;
                       a.GW_Volunteers__Volunteer_Skills__pc = account.GW_Volunteers__Volunteer_Skills__pc;
                       a.Special_Skills__c = account.Special_Skills__c;
                       a.Experience_Level_With_Cats__c = account.Experience_Level_With_Cats__c;
                       a.Experience_Level_with_Dogs__c = account.Experience_Level_with_Dogs__c;
                       a.Emergency_Contact_Name__pc = account.Emergency_Contact_Name__pc;
                       a.Emergency_Contact_Home_Phone__pc = account.Emergency_Contact_Home_Phone__pc;
                       a.Emergency_Contact_Work_Phone__pc = account.Emergency_Contact_Work_Phone__pc;
                       a.Emergency_Contact_Email__pc = account.Emergency_Contact_Email__pc;
                       a.Terms_Conditions_Accepted__pc = account.Terms_Conditions_Accepted__pc;
                       a.Age_Checkbox__c = account.Age_Checkbox__c;
                       upsert a;
                      }
                    else
                       insert account;
                }        
            catch(Exception e){
                ApexPages.addMessages(e);
                return null;
            
                }
          PageReference pageRef = new PageReference('http://www.pawsatlanta.org/thank-you-for-saving-a-life');
          pageRef.setRedirect(true);
          return pageRef; 
  
          }
         Else {
             account.Terms_Conditions_Accepted__pc.addError('Please Accept Terms and Conditions');
             return null;
         }
     }
     Else {
     
            ApexPages.Message message = new ApexPages.message(ApexPages.severity.ERROR,'Person Account Already Exists');
            ApexPages.addMessage(message);
            return null;
     
     }
     
    
   }

 
    public String pawsLogo { get {
        document doc = [ SELECT Id, Name FROM Document WHERE Name = 'PAWS Logo' limit 1];
        string imageid = doc.id; 
        imageid = imageid.substring(0,15);
        return '/servlet/servlet.FileDownload?file=' + imageid;
        }  set; }
    
    
}

 
I am very new to writing apex code and have come to a roadblock when it comes to moving the updated Visualforce page I've helped edit out of the sandbox and into production. When I created the changeset I added the visual force page and associate apex class that I've been working in. When I went to validate this change set in production I got several component errors. Namely that a certain variable doesn't exist and that the apex class I thought I'd created didn't exist as well.

Below I've attached the code where several of the errors exist namely that the Variable: Special_Skills__c doesn't exist. I have done some trailheads and googled other questions to get to the point where the visualforce page created is exactly what we are looking for. I just need some help in overcoming these errors so that I can get this into production ASAP in addition to increasing my knowledge of code and working in a sandbox and ultimately transferring this information into production. Thanks in advance!

//get the multi-select pick list values
    public List<SelectOption> MPOptions3 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult SpecialSkills = Schema.account.Special_Skills__c.getDescribe();  
     
       List<Schema.PicklistEntry> f = SpecialSkills.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }

    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems3 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.Special_Skills__c !=null && this.account.Special_Skills__c.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.Special_Skills__c = selectedCheckBox;
     }
   } 
   
 
List of Apex Test Failures
So I've run into some issues that I've not seen before as I attempt to move an updated visualforce page and apex class out of the sandbox and into production. I'm not sure what the CTLR_VolunteerAppliationTest is referring to, so I'm not sure where to start to fix this problem. The second set of failures regarding System.DmlException: Insert failed. don't make sense as the class names listed: Paypal_Autherization and below aren't even included anywhere on the visualforce page or apex class I am attempting to move. Any pointers for a newbie to apex testing and visualforce development would be greatly appreciated.

For Reference Apex Class Code:

public with sharing class CTLR_VolunteerApplication_Updates {
    public final ApexPages.StandardController controller;
    public Account account { get; set;}
    
    public CTLR_VolunteerApplication_Updates(ApexPages.StandardController controller) {
        this.controller = controller;
        this.account = (Account)controller.getRecord();
        
    }
      
    public String salutation {get; set;}
    public String fname {get; set;}
    public String lname {get; set;}  
    
    //get the multi-select pick list values
    public List<SelectOption> MPOptions {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult volunteerAvail = Schema.Account.GW_Volunteers__Volunteer_Availability__pc.getDescribe();
         
       List<Schema.PicklistEntry> f = volunteerAvail.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }
    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.GW_Volunteers__Volunteer_Availability__pc !=null && this.account.GW_Volunteers__Volunteer_Availability__pc.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.GW_Volunteers__Volunteer_Availability__pc = selectedCheckBox;
     }
   } 
    
    
    //get the multi-select pick list values
    public List<SelectOption> MPOptions2 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult volunteerInterests = Schema.Account.GW_Volunteers__Volunteer_Skills__pc.getDescribe();
         
       List<Schema.PicklistEntry> f = volunteerInterests.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }
    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems2 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.GW_Volunteers__Volunteer_Skills__pc !=null && this.account.GW_Volunteers__Volunteer_Skills__pc.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.GW_Volunteers__Volunteer_Skills__pc = selectedCheckBox;
     }
   } 
    
//get the multi-select pick list values
    public List<SelectOption> MPOptions3 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult SpecialSkills = Schema.account.Special_Skills__c.getDescribe();  
     
       List<Schema.PicklistEntry> f = SpecialSkills.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }

    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems3 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.Special_Skills__c !=null && this.account.Special_Skills__c.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.Special_Skills__c = selectedCheckBox;
     }
   } 
   
    public PageReference submit() {
      integer count = 0;
      count = [SELECT count() FROM Account WHERE FirstName = :account.FirstName AND LastName = :account.LastName ];
      System.debug('count' + count);
      
      if ( count == 0 )    {
      
          if (account.Terms_Conditions_Accepted__pc)  {
              try{
                    RecordType personAccountRecordType =  [SELECT Id FROM RecordType WHERE Name = 'Person Account' and SObjectType = 'Account'];
                    account.RecordType = personAccountRecordType;
                    account.Salutation = salutation;
                    account.FirstName = fname;
                    account.LastName = lname;
                    account.Contact_Email__c = account.PersonEmail;
                    account.Volunteer_Application_Submitted__c = true;
                    if ( [ SELECT count() FROM Account WHERE PersonEmail = :account.PersonEmail ] > 0 )
                      {
                       
                       Account a = [SELECT    Id,
                                              Salutation,
                                              FirstName,
                                              LastName,
                                              Contact_Email__c, 
                                              Volunteer_Application_Submitted__c,   
                                              PersonMailingStreet, 
                                              PersonMailingState,
                                              PersonMailingCity,
                                              PersonMailingPostalCode,
                                              PersonHomePhone,
                                              Phone,
                                              PersonEmail,
                                              Allergies_and_or_Restrictions__pc,
                                              How_did_you_hear_about_us__pc,
                                              Current_Occupation__pc,
                                              GW_Volunteers__Volunteer_Availability__pc,
                                              GW_Volunteers__Volunteer_Skills__pc,
                                              Special_Skills__c,
                                              Experience_Level_With_Cats__c,
                                              Experience_Level_with_Dogs__c,         
                                              Emergency_Contact_Name__pc,
                                              Emergency_Contact_Home_Phone__pc,
                                              Emergency_Contact_Work_Phone__pc,
                                              Emergency_Contact_Email__pc,
                                              Terms_Conditions_Accepted__pc,
                                              Age_Checkbox__c
                                           FROM Account
                                           WHERE PersonEmail = :account.PersonEmail OR Contact_Email__c = :account.PersonEmail LIMIT 1] ;
                       a.RecordType = personAccountRecordType;
                       a.Salutation = salutation;
                       a.FirstName = fname;
                       a.LastName = lname;
                       a.Contact_Email__c = account.PersonEmail;
                       a.PersonEmail = account.PersonEmail;
                       a.Volunteer_Application_Submitted__c = true;
                       a.PersonMailingStreet = account.PersonMailingStreet;
                       a.PersonMailingState  = account.PersonMailingState;
                       a.PersonMailingCity = account.PersonMailingCity;
                       a.PersonMailingPostalCode = account.PersonMailingPostalCode;
                       a.PersonHomePhone = account.PersonHomePhone;
                       a.Phone = account.Phone;
                       a.Allergies_and_or_Restrictions__pc = account.Allergies_and_or_Restrictions__pc;
                       a.How_did_you_hear_about_us__pc = account.How_did_you_hear_about_us__pc;
                       a.Current_Occupation__pc = account.Current_Occupation__pc;
                       a.GW_Volunteers__Volunteer_Availability__pc = account.GW_Volunteers__Volunteer_Availability__pc;
                       a.GW_Volunteers__Volunteer_Skills__pc = account.GW_Volunteers__Volunteer_Skills__pc;
                       a.Special_Skills__c = account.Special_Skills__c;
                       a.Experience_Level_With_Cats__c = account.Experience_Level_With_Cats__c;
                       a.Experience_Level_with_Dogs__c = account.Experience_Level_with_Dogs__c;
                       a.Emergency_Contact_Name__pc = account.Emergency_Contact_Name__pc;
                       a.Emergency_Contact_Home_Phone__pc = account.Emergency_Contact_Home_Phone__pc;
                       a.Emergency_Contact_Work_Phone__pc = account.Emergency_Contact_Work_Phone__pc;
                       a.Emergency_Contact_Email__pc = account.Emergency_Contact_Email__pc;
                       a.Terms_Conditions_Accepted__pc = account.Terms_Conditions_Accepted__pc;
                       a.Age_Checkbox__c = account.Age_Checkbox__c;
                       upsert a;
                      }
                    else
                       insert account;
                }        
            catch(Exception e){
                ApexPages.addMessages(e);
                return null;
            
                }
          PageReference pageRef = new PageReference('http://www.pawsatlanta.org/thank-you-for-saving-a-life');
          pageRef.setRedirect(true);
          return pageRef; 
  
          }
         Else {
             account.Terms_Conditions_Accepted__pc.addError('Please Accept Terms and Conditions');
             return null;
         }
     }
     Else {
     
            ApexPages.Message message = new ApexPages.message(ApexPages.severity.ERROR,'Person Account Already Exists');
            ApexPages.addMessage(message);
            return null;
     
     }
     
    
   }

 
    public String pawsLogo { get {
        document doc = [ SELECT Id, Name FROM Document WHERE Name = 'PAWS Logo' limit 1];
        string imageid = doc.id; 
        imageid = imageid.substring(0,15);
        return '/servlet/servlet.FileDownload?file=' + imageid;
        }  set; }
    
    
}

 
I am very new to writing apex code and have come to a roadblock when it comes to moving the updated Visualforce page I've helped edit out of the sandbox and into production. When I created the changeset I added the visual force page and associate apex class that I've been working in. When I went to validate this change set in production I got several component errors. Namely that a certain variable doesn't exist and that the apex class I thought I'd created didn't exist as well.

Below I've attached the code where several of the errors exist namely that the Variable: Special_Skills__c doesn't exist. I have done some trailheads and googled other questions to get to the point where the visualforce page created is exactly what we are looking for. I just need some help in overcoming these errors so that I can get this into production ASAP in addition to increasing my knowledge of code and working in a sandbox and ultimately transferring this information into production. Thanks in advance!

//get the multi-select pick list values
    public List<SelectOption> MPOptions3 {
     get {
       List<SelectOption> options = new List<SelectOption>();
       
       DescribeFieldResult SpecialSkills = Schema.account.Special_Skills__c.getDescribe();  
     
       List<Schema.PicklistEntry> f = SpecialSkills.getPicklistValues();
       Integer listSize = f.size();
         
       for(Schema.PicklistEntry a : f) {
           options.add(new SelectOption(a.getValue(), a.getLabel()));
        } 
       return options;
     }  
     set;
    }

    
    //get and set the multi-select pick list as checkboxes
       public String[] MPItems3 { 
     get {
        String[] selected = new List<String>();
        List<SelectOption> sos = this.MPOptions;
        for(SelectOption s : sos) {
        if (this.account.Special_Skills__c !=null && this.account.Special_Skills__c.contains(s.getValue()))
           selected.add(s.getValue());
        }
        return selected;
     }public set {
        String selectedCheckBox = '';
        for(String s : value) {
         if (selectedCheckBox == '') 
           selectedCheckBox += s;
         else selectedCheckBox += ';' + s;
        }
        account.Special_Skills__c = selectedCheckBox;
     }
   }