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
RiyajRiyaj 

How i reteive the ID from APex?

Hi,

 

I Apex Class I m using,

 

List<Class__c> r =[SELECT Day_of_Week__c,end_Time__c,start_Time__c,teacher_Name__c,Name from Class__c WHERE teacher_Name__c =:teachername];
Class__c r1;
if(r.size()>0)
{
r1=new Class__c(Name=r[0].Name);
   return r[0];
   }
else
   return new Class__c();

 in above coding Query area i m using Teacher Name, but that query is return null value. But tha table have a value.

 

               After that I using delevloper console, there only i found one problem. normally the query return the Id value of Teacher's name.. So i seraching the Id value from Teacher Name's Tables but I cant find out it. So I dont know how to use teacher name , how to reterive the ID form Apex...??

 

NULL Value Return Code:

getClassName.Class__c getClassNameResponse = getClassNameObj.getClassFromTeacherName(Session["Username"].ToString());
      

 Value Return Code ( Another try)

getClassName.Class__c getClassNameResponse = getClassNameObj.getClassFromTeacherName("0039000000CYPbNAAX");

 


colemabcolemab

is teachername blank or otherwise invalid?  that could cause null results when the table contains data . . . .