+ Start a Discussion
RiyajRiyaj 

How do I Select 'Name' Field Data's from Apex Class?

Hi,

In Contact I m  using Some Fields ...

Standard Fields
Name

Cutomize Fields
ContactType
ClassName,

I want to select the Contact's under given condition.....

Conditions
1. ContactType ="Student"
2.ClassName=//** Get from Passing Parameter **//

-----------  Contact Custom Fields Screen -----------------------------

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You need to append '__c' to class_name - note that there are two underscores here, not one.

 

E.g.

 

List<Contact> c = [SELECT Name from Contact WHERE Class_Name__c = :classname];