Skip to main content

Challenge not yet complete in New for job application

We can’t find the correct SOQL query in the PropertyUtility class. 

 

public class PropertyUtility { 

    public static void newListedProperties() { 

       List<Property__c> newPropList = [ 

            SELECT Name, Broker__r.Email__c, Days_On_Market__c 

            FROM Property__c 

            WHERE Date_Listed__c >= LAST_N_DAYS:30 

        ]; 

        for (Property__c newProp : newPropList) { 

            String propEmail =

newProp.Name

+ ' : ' + newProp.Broker__r.Email__c; 

            System.debug(propEmail); 

        } 

    } 

 

 

#Trailhead Challenges

3 answers
  1. Dec 2, 2025, 8:35 PM

    Hi , 

     

    You may try with below apex class: 

     

    public class PropertyUtility{

    public static void newListedProperties(){

    List<Property__c> newPropList = [Select Name,Days_On_Market__c,Broker__r.Email__c from Property__c where Days_On_Market__c < 31];

    for(Property__c p : newPropList){

    string propEmail = p.Name +':'+ p.Broker__r.Email__c ;

    system.debug(propEmail);

    }

    }

    }

     

    https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A909ISAR

0/9000