You need to sign in to do that
Don't have an account?
Riyaj
How do I add record from Class?
I m usng new customize object name 'Class' inside this {'Name', 'Teacher Name'} , Now I want execute query.... i want to get a class name.. but I got a error"
Apex Code
global class getClassName{ WebService static Class getClassFromTeacherName(string teachername){ List<Class> r=[SELECT Name from Class WHERE teacher_Name__c = :teachername]; if(c.size()>0){ l=new Class(Name=c[0].Name); } return l; } }
Error
Error: Compile Error: getClassName.getClassFromTeacherName: Types cannot be marked as web services at line 2 column 25
Hi,
Class is a custom object, so when you use it in your apex code, it should be used as "Class__c".
I believe here you want to send back the Class object which has the teacher name which you are sending in the parameter.
So this code should help you: