• Abhishek Singh 175
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Create a query and assign the query results to the list
Get this information:
The name of the property
The broker’s email address
How long the property has been on market
(Hint: Use API names, not field names or field labels)
Object: Property

I WANT TO KNOW HOW TO WRITE BELOW QUERY FOR PROPERTY LISTED IN LAST 30 DAYS....

Condition: The property was listed within the last 30 days

public class PropertyUtility {
    public static void newListedProperties(){
        //list<Property__c> newPropList= new List<Property__c>();
        List<Property__c> newPropList=[select name,  broker__r.email__c from Property__c where CreatedDate= LAST_N_DAYS:30];
        //newPropList.add(pro);
        
        for(Property__c p:newPropList){
             String propEmail=  +p.name+ ':' +p.broker__r.email__c;
            system.debug(propEmail);
            
        }
        
    }

}
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