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