You need to sign in to do that
Don't have an account?
Sujendran Sundarraj 8
Query in Extension Controller returns null with id from page
Hello All,
I have a doubt, I have a standardcontroller for case object along with an extension controller. I am getting the id from the page and trying to query the case with the same id but the query is returning null. can you please help me to clear my doubt. Below is my code.
when I put a debug statement for caseid it is showing the id
but debug statement for c is returning null.
I have a doubt, I have a standardcontroller for case object along with an extension controller. I am getting the id from the page and trying to query the case with the same id but the query is returning null. can you please help me to clear my doubt. Below is my code.
public class Testclass { public list<case> c {get; set;} public id caseid {get; set;} public Testclass(ApexPages.StandardController controller) { caseid = apexpages.currentpage().getparameters().get('id'); system.debug(caseid); c = [select id, casenumber,subject, account.id from case where Id =: caseid]; system.debug(c); } }
when I put a debug statement for caseid it is showing the id
but debug statement for c is returning null.
The mistake is general You should use your standradcontroller instance to get the Id.
Do These Changes on Code:-->
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com