+ Start a Discussion
Guillaume MéheustGuillaume Méheust 

'Using Future Methods'  Trailhead Issue


When I'm trying to Check Challenge, I receive this king of message : "The 'Number_Of_Contacts__c' field does not exist on the Account object."

I've double/triple checked if this field was present and ... it is.
I don't understand since all the test are goods.

Could you help me with this issue ?

Best Answer chosen by Guillaume Méheust
Mahesh DMahesh D
Please consider below points:

==> check the permissions / FLS for that field.
==> Check the API Name 


All Answers

Mahesh DMahesh D
Please consider below points:

==> check the permissions / FLS for that field.
==> Check the API Name 

This was selected as the best answer
global class AccountProcessor {
public static void countContacts (Set<id> setId)  {
 List<Account> lstAccount= [SELECT Id, Number_of_Contacts__c, (SELECT Id FROM Contacts) FROM Account where id in : setid];
for(Account acc : lstAccount)
          List<Contact> lstCont = acc.contacts ;
                    acc.Number_of_Contacts__c = lstCont.size();

update lstAccount;

HI Use this code
Make sure that the new field has __c Appended and its named right as per the challenge requirement
Conor DowneyConor Downey

Can you tell me why its SELECT Id FROM Contacts? What is Contacts? The table is Contact so why is Cotnacts used here?
Mahesh DMahesh D
Hi Conor,

Its a Child Relationship and look into the below links:

Relationship Queries:
If Job_Application__c is the child Object and Review__c is the parent object then
List<Job_Application__c> jaList = [Select Id, Name, Review__c, Review__r.Name from Job_Application__c];

If Review__c is the child Object and Job_Application__c is the parent object then
List<Review__c> rList = [Select Id, Name, Job_Application__c, Job_Application__r.Name from Review__c];

Also look into the below links for more information about Relationship Queries:






Please do let me know if it helps you.


Kellan ScheiberKellan Scheiber
I am getting the same error message and I have updated all field level securities and am still getting the same message. Not sure what else to do. Have renamed numerous times both API and UI and still no luck
Hi Kellan,

If you have namespace created on your org, you'll see this error even if you've setup this field correctly.

In order to resolve this you can setup a trailhead hands on org, as you can not delete the namespace in your org and then associate it with your trailhead account to complete this trailhead module.

Here is how you can check if you've namespace setup on your developer org:

1. Click on setup >> search for packages in quick find >> click on package and you'll see namespace information if set or it'll show none.
2. Create a new developer org >> now from your existing trailhead account >> click on manage my hands on org >> click on connect to an org and verify your new developer org.
3. Once verfied click on check challenge

You shoule be able to complete it.

Ashok Kumar NayakAshok Kumar Nayak

Look for this 
User-added image
And select the org in which you developed your code.

Sample Class:-

Public class AccountProcessor {
  public static void countContacts(List<Id> recordIds) {
    List<Account> accounts = [Select Id,Name,(select Id from Contacts) from Account Where Id IN :recordIds];
    for(Account a : accounts)
    update accounts;

Test Class:-
private class AccountProcessorTest {

@IsTest static void countContactsTest() {
Account a = new Account(Name='ABCD');
insert a;
List<Id> AcId = new List<Id>();
Contact c = new Contact(LastName='ABCD',AccountId=a.Id);
insert c;
for(Account acc : [select id from Account where id=:a.Id])


You should enter "Number_Of_Contacts" to Field Label
※“Number_Of_Contacts__c” is wrong