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
umavidyullatha polavrapuumavidyullatha polavrapu 

hi all, want help on soql query for the challange in 'building apex coding skills' propertyutility.can anyone help me on this

string propEmail;
   list<property__C> newPropList=[select name,days_on_market__c,broker__r.email__c from property__c where date_listed__c>=LAST_N_DAYS:30];    
                                  system.debug('The list items are........:'+newPropList);
    for(property__C p:newproplist)
     {
         propEmail=p.name+':'+p.broker__r.email__c;
         system.debug('The concatenated string is.....:'+propEmail);
     }
     getting the following error:
Challenge not yet complete in My Trailhead Playground 2
We can’t find the correct SOQL query in the PropertyUtility class.
this is my solution..any corrections let me know..tq
Best Answer chosen by umavidyullatha polavrapu
umavidyullatha polavrapuumavidyullatha polavrapu
Thanks Vinay Kumar...it worked...

All Answers

VinayVinay (Salesforce Developers) 
Hi,

Try below code and it should work.
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);
        }
    }
}

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
umavidyullatha polavrapuumavidyullatha polavrapu
Thanks Vinay Kumar...it worked...
This was selected as the best answer
smriti sharan19smriti sharan19
public class PropertyUtility {
    
    public static void newListedProperties(){
        List<Property__c> newPropList = [Select Name,id,Days_On_Market__c,Broker__r.Email__c from Property__c where Days_On_Market__c <31];
        for(Property__c proplist :newPropList){
            String propEmail = proplist.name+':'+proplist.Broker__r.Email__c;  
            system.debug(propEmail);
        }
    }
    
}
Joe HickoxJoe Hickox
I wrote out my public class exactily as above but when I go to the Open Execute Anonymous Window and put in 'PropertyUtility.newListedPropertiesgo ();' I keep gettin an error msg. Method does not exist or incorrect signature: void newListedPropertiesgo() from the type PropertyUtility. What am I doing wrong?
Fekade AbaynehFekade Abayneh
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 Days_On_Market__c <= 30];
        for ( Property__c prop: newPropList){
            String propEmail = prop.Name + ' : '+ prop.Broker__r.Email__c;
            System.debug(propEmail);
        }
    }
}
Abhishek Singh 175Abhishek Singh 175
public class PropertyUtility {
    Public Static Void newListedPropertie()
    {
    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 Prop: newPropList)
        {
           String propEmail= 'Property Name'+Prop.Name+':' +'Broker Email'+Prop.Broker__r.Email__c;
            System.debug(propEmail);
        }
    }

}