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
陳蕙心 Cymbi Chen陳蕙心 Cymbi Chen 

Using Field that don't exist? Trailhead Challenge: Write SOQL Queries

I think I have skipped some instruction there and pozzled with the outcome of this unit. What kind of key words sould I use to ferther understand this topic?

The scenario is that I finished the unit Chanllenge with code as fallowing:
public class ContactSearch {
    public static List<Contact> searchForContacts(string targetLastName, string targetPostalCode)
    {
		List<Contact> matchCon = [select ID,Name from Contact where LastName = :targetLastName and MailingPostalCode = :targetPostalCode];
        return matchCon;
    }
}
But in the object manager of Contact, I didn't see any field named: LastName and MailingPostalCode.

How could the code be using Field that don't evern exist in Contact and not be compile error? What kind of key words sould I use to ferther understand this topic?
Best Answer chosen by 陳蕙心 Cymbi Chen
SandhyaSandhya (Salesforce Developers) 
Hi,

You can see the fileds of any object under Fields.If you are in classic go to SetUp--build--customize--contact--fields. I would suggest you read the content from the first unit of the module and then attempt the challenge so that you can learn more.

User-added image

 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
 
Best Regards
Sandhya
 

All Answers

Raj VakatiRaj Vakati
 LastName  and First Name together will be displayed as Name  (
Concatenation of FirstName, MiddleName, LastName, and Suffix up to 121 characters.)

MailingPostalCode is part of the mailing address compound field. Please refer this link


https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_address.htm
SandhyaSandhya (Salesforce Developers) 
Hi,

You can see the fileds of any object under Fields.If you are in classic go to SetUp--build--customize--contact--fields. I would suggest you read the content from the first unit of the module and then attempt the challenge so that you can learn more.

User-added image

 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
 
Best Regards
Sandhya
 
This was selected as the best answer
陳蕙心 Cymbi Chen陳蕙心 Cymbi Chen
Thank you @Sandhya, now I understand that only in [Salesforce Classic] it would show all the Fields for one object at one glance. I've been using Lightening for all these time, no wonder couldn't see all of the Fields of Contact and be pozzled.