You need to sign in to do that
Don't have an account?
SFine
ApexPages.currentPage().getParameters().put() Not passing information?
Hello, a strange bug for me came up just about an hour ago, involving the ApexPages.currentPage().getParameters().put(); feature.
I keep getting a nullpointer exception: de-referencing a null object. And It's narrowed down to this particular line. Here's some sample test code where it occurs
Quote opp=[select Id from Quote limit 1]; QuoteLineItem ql1 = new QuoteLineItem(); QuoteLineItem ql2 = new QuoteLineItem(); PricebookEntry CL = [Select Product2.Name, Product2.Family, UnitPrice from PricebookEntry Where Product2.Family='Power' limit 1]; PricebookEntry ST = [Select Product2.Name, Product2.Family, UnitPrice from PricebookEntry Where Product2.Family='Systems' limit 1]; ql1.PricebookEntryId=CL.Id; ql1.Quantity=1; ql1.UnitPrice=CL.UnitPrice; ql1.QuoteId=opp.Id; insert ql1; ql2.PricebookEntryId=ST.Id; ql2.QuoteId=opp.Id; ql2.UnitPrice=ST.UnitPrice; ql2.Quantity=1; insert ql2; PageReference pageRef = Page.quotePDF; Test.setCurrentPage(pageRef); ApexPages.currentPage().getParameters().put('Id', opp.id); //quotePDFController qc= new quotePDFController(ApexPages.StandardController(q)); quotePDFController qc= new quotePDFController();
Any idea what's happening? Considering that it just randomly began to happen, I'm ver confused.
Rather than setting the current reference and then getting it again, perhaps you'd be better off doing something like
Thanks you saved my time :)