You need to sign in to do that
Don't have an account?
Riby Varghese
customer id null
Customer id becomes null?? Can anyone help
public CaseLoyaltyCtrl(ApexPages.StandardController stdController) { // Constructor
stdCtrl=stdController;
thisCase = (Case)stdCtrl.getRecord();
customerID = ApexPages.currentPage().getParameters().get('id');
System.debug('customerID==='+customerID);
//if(!customerID.equalsIgnoreCase(null))
if(!string.isEmpty(customerID))
{
setCustomerName();
}
//thisAccount = (Account)stdController.getRecords();
// System.debug('thisAccount.Name'+thisAccount.Name);
}
public CaseLoyaltyCtrl(ApexPages.StandardController stdController) { // Constructor
stdCtrl=stdController;
thisCase = (Case)stdCtrl.getRecord();
customerID = ApexPages.currentPage().getParameters().get('id');
System.debug('customerID==='+customerID);
//if(!customerID.equalsIgnoreCase(null))
if(!string.isEmpty(customerID))
{
setCustomerName();
}
//thisAccount = (Account)stdController.getRecords();
// System.debug('thisAccount.Name'+thisAccount.Name);
}
CustomerId value is null means you dont have assigned the value to the parameter id in somewhere.
you should have set a value to the id like
ApexPages.currentPage().getParameters().put('id',your_value );
or you should have a query string Id value in the url like,
https://developer.salesforce.com/forums?id=9060G0000005ai0QAA
Best regards
If it is apex controller use:
https://your instanceId or custom URL .salesforce.com/apex/VFName?Id=00000000xxxx
(OR)
if it is test class refer the below code snippet
// at first you have to create the object DB_Object__c dbObj = new DB_Object__c(); dbObj.Name = 'test'; dbObj.Setting = 'aSetting'; insert dbObj;
// then you'd call the vf page with the id query paramter Test.setCurrentPageReference(Page.Demo); ApexPages.currentPage().getParameters().put('id', dbObj.Id);
dbObj = [Select All, Fields, You, Need From DB_Object__c Where Id = :ApexPages.currentPage().getParamters().get('id')]; // then the StandardController & controller extension get initiated ApexPages.StandardController sc = new ApexPages.StandardController(dbObj);
MyExtension myExt = new MyExtension(sc);