I want to get both created date of today's Opportunity as well as the last-modified date of today's Opportunity in SOQL? how to Query that? Thanks in Advance.

SELECT Id,Name,Project_ID__c,RecordType.DeveloperName from Opportunity where RecordType.DeveloperName ='Recent_Type' and Project_ID__c !='' and (CreatedDate=Today  OR lastmodifiedDate = today)
  • Does the query you provided not return the results you're looking for? You need to edit your question to better explain what the issue is.
    – Derek F
    Feb 14, 2021 at 13:49
  • I want to make sure this will this return today created as well as updated date Opportunity Record? I want both today createdDate Opportunity or LastModifiedDate Opportunity how to Query ? Feb 14, 2021 at 14:06
  • 2
    That's something that you should figure out before asking a question. It'd be faster for you to run your query and observe the results than ask here and wait for an answer.
    – Derek F
    Feb 14, 2021 at 19:57

1 Answer 1


Your query is fine. It will return you the opportunities which are either created today or are modified today. but if you want to see the created date and last modified date for your returned records then you will need to add CreatedDate and LastModifiedDate in your select query like you are doing for Project_ID__c.

SELECT Id, Name, Project_ID__c, RecordType.DeveloperName, LastModifiedDate, CreatedDate from Opportunity where RecordType.DeveloperName ='Recent_Type' and Project_ID__c !='' and (CreatedDate=TODAY OR LastModifiedDate = TODAY)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .