• Christopher Cosgrove
  • NEWBIE
  • 5 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi Everyone!

I am still learning about apex and I've created a class but now I am lost as to where and how to create a test class.


public class myVFController{

    public myVFController(ApexPages.StandardController controller) {

    }

     public string testobject{get;set;} 
     public integer count{get;set;}
     public integer count1{get;set;}
     public integer count2{get;set;}
     public integer count3{get;set;}
     public integer count4{get;set;}
     public integer count5{get;set;} 
     public integer count6{get;set;}
     public integer count7{get;set;}
     public integer count8{get;set;}
     public integer count9{get;set;}
     public integer count10{get;set;}
     public integer count11{get;set;}
     public integer count12{get;set;}
     public integer count13{get;set;}
     public integer count14{get;set;}
     public integer count15{get;set;} 
    
public ApexPages.StandardSetController stdCntrlr {get; set;}
 public myVFController(ApexPages.StandardSetController controller) {
        stdCntrlr = controller;
    }
        
    public pagereference myvfcontroller1(){
       // count++;
     
        VF_Count__c mc = VF_Count__c.getInstance('Count1');        
        system.debug('mc'+mc);
           
        count1 = integer.valueof(mc.Count__c);
        count1++;
        
        VF_Tracking__c newTracking = new VF_Tracking__c(User__c=UserInfo.getUserId(),VF_Page_Visited__c='10-21-16 Alt Net Option',Datetime_Visited__c=datetime.now());
        insert newTracking; 
        VF_Count__c countinsert = new VF_Count__c();
        countinsert.name = 'Count1';
        countinsert.count__c = count1;
        countinsert.id =mc.id;
        update countinsert;
        testobject = newTracking.id;
        system.debug('newTrackingnewTracking'+newTracking);
        return null;
    }

Any help is greatly appreciated!
I am looking to create a counter for my VF pages.

I have a apex class that I am looking to pull in the record type in of the vf pages. Field is VF_Page_Visited__c object is F_Enhancement_Change_Log__c

public class myVFController{
    public string testobject{get;set;} 
    
    public pagereference myvfcontroller(){
        VF_Tracking__c newTracking = new VF_Tracking__c(User__c=UserInfo.getUserId(),VF_Page_Visited__c=SF_Enhancement_Change_Log__c.RecordType.Name,Datetime_Visited__c=datetime.now());
        insert newTracking; 
        testobject = newTracking.id;
        system.debug('newTrackingnewTracking'+newTracking);
        return null;
    }

}
Hi Everyone!

I am still learning about apex and I've created a class but now I am lost as to where and how to create a test class.


public class myVFController{

    public myVFController(ApexPages.StandardController controller) {

    }

     public string testobject{get;set;} 
     public integer count{get;set;}
     public integer count1{get;set;}
     public integer count2{get;set;}
     public integer count3{get;set;}
     public integer count4{get;set;}
     public integer count5{get;set;} 
     public integer count6{get;set;}
     public integer count7{get;set;}
     public integer count8{get;set;}
     public integer count9{get;set;}
     public integer count10{get;set;}
     public integer count11{get;set;}
     public integer count12{get;set;}
     public integer count13{get;set;}
     public integer count14{get;set;}
     public integer count15{get;set;} 
    
public ApexPages.StandardSetController stdCntrlr {get; set;}
 public myVFController(ApexPages.StandardSetController controller) {
        stdCntrlr = controller;
    }
        
    public pagereference myvfcontroller1(){
       // count++;
     
        VF_Count__c mc = VF_Count__c.getInstance('Count1');        
        system.debug('mc'+mc);
           
        count1 = integer.valueof(mc.Count__c);
        count1++;
        
        VF_Tracking__c newTracking = new VF_Tracking__c(User__c=UserInfo.getUserId(),VF_Page_Visited__c='10-21-16 Alt Net Option',Datetime_Visited__c=datetime.now());
        insert newTracking; 
        VF_Count__c countinsert = new VF_Count__c();
        countinsert.name = 'Count1';
        countinsert.count__c = count1;
        countinsert.id =mc.id;
        update countinsert;
        testobject = newTracking.id;
        system.debug('newTrackingnewTracking'+newTracking);
        return null;
    }

Any help is greatly appreciated!
Hi,

I have a Normal Picklist field(which is a controlling picklist) say pickA and a multi-select picklist say pickB(which is the dependent picklist to the picklist pickA) on a custom object.
I have a Visualforce page containing those 2 picklists. On selecting a value from picA and selecting some values from pickB and clicking on Save saves the picklist values to the database but on Edit, the value selected in picA gets displayed but the selected values from multi-select picklist picB are not getting displayed under "Chosen" and instead all are showing under "Available" as if no value is selected.

Please let me know how to resolve this. 


Thanks a lot.
Hi,

I have a Normal Picklist field(which is a controlling picklist) say pickA and a multi-select picklist say pickB(which is the dependent picklist to the picklist pickA) on a custom object.
I have a Visualforce page containing those 2 picklists. On selecting a value from picA and selecting some values from pickB and clicking on Save saves the picklist values to the database but on Edit, the value selected in picA gets displayed but the selected values from multi-select picklist picB are not getting displayed under "Chosen" and instead all are showing under "Available" as if no value is selected.

Please let me know how to resolve this. 


Thanks a lot.