• divesh khanduja
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi 
I am using Standard controller (Case ) with extesion controller  I ma upsertingthe case record in amy controller ;
public with sharing Myclass{


//Constructor   

  
    public myController(ApexPages.StandardController stdController){
    
   
            try{
            this.caseId= ApexPages.currentPage().getParameters().get('id');
            if(caseId != null)
                oCase = [select Id, CaseNumber,AccountId, Owner.Name, Status, Priority, Origin, Contact.Name, Account.Name, Type, Reason, Subject, Description,(Select CommentBody from CaseComments order by createddate limit 1) from Case where Id = :caseId];
        } 
        catch(Exception e){
            ExceptionLogger.addException(e,'myController','Constructor'); 
            
        }
    }    
    
     public PageReference save(){

    upsert oCase;
   PageReference pg = new PageReference('/apex/Mypage');
   pg.getParameters().put('id',oCase.Id);        
    flag1=true;
    flag2= false;
    return pg;

}

When I try to cover /run the test class on save() in Test Class , after inserting Case it give me an error 
Attempted to upsert a null list

//Test Class Code :

Insert CaseList[with data ];
System.debug('showCas caseList= '+caseList); //Here i can see the case list 
ApexPages.Standardcontroller sc = new ApexPages.Standardcontroller(caseList[0]);
        myController controller = new myController(sc);
        controller.save() // Attempted to upsert a null list
Please help me ! Really needed ,

Thanks in Advance ! 
Hi 
I am using Standard controller (Case ) with extesion controller  I ma upsertingthe case record in amy controller ;
public with sharing Myclass{


//Constructor   

  
    public myController(ApexPages.StandardController stdController){
    
   
            try{
            this.caseId= ApexPages.currentPage().getParameters().get('id');
            if(caseId != null)
                oCase = [select Id, CaseNumber,AccountId, Owner.Name, Status, Priority, Origin, Contact.Name, Account.Name, Type, Reason, Subject, Description,(Select CommentBody from CaseComments order by createddate limit 1) from Case where Id = :caseId];
        } 
        catch(Exception e){
            ExceptionLogger.addException(e,'myController','Constructor'); 
            
        }
    }    
    
     public PageReference save(){

    upsert oCase;
   PageReference pg = new PageReference('/apex/Mypage');
   pg.getParameters().put('id',oCase.Id);        
    flag1=true;
    flag2= false;
    return pg;

}

When I try to cover /run the test class on save() in Test Class , after inserting Case it give me an error 
Attempted to upsert a null list

//Test Class Code :

Insert CaseList[with data ];
System.debug('showCas caseList= '+caseList); //Here i can see the case list 
ApexPages.Standardcontroller sc = new ApexPages.Standardcontroller(caseList[0]);
        myController controller = new myController(sc);
        controller.save() // Attempted to upsert a null list
Please help me ! Really needed ,

Thanks in Advance ! 
Hi,

I want navigate from lightning to apex visualforce page. And I used window.top.location and the page will be shown without sidebar.
How to use navigateToURL? I tried to use like below js but it doesn't work.
navigateTest: function(component, e, helper){
        $A.get("e.force:navigateToURL").setParams({"url": "/apex/test"}).fire();

    }

Does someone know this? Thanks a lot.