function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Riby VargheseRiby 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);
    }
Sampath SuranjiSampath Suranji
Hi,
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
GhanshyamChoudhariGhanshyamChoudhari
https://YOURDOMAIN.visual.force.com/apex/YOURVFNAME?id=0017F0000xxxxxxx 
<!-- pass account id to URL -->

 
Fazurulla GagangapalliFazurulla Gagangapalli
Hi There,

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);