On a visual-force page of a workorder record, I've to display list of workorders created for the same location where the createddate is within the last 30 days of the creationdate of the current record.
For ex: If the current record was created on Jan 31st for a location A, I want to display all the workorders that were created from Jan 1st to 31st for location A. This is the query I've but it obviously displays records created in last 30 days but not the records created in last 30 days of createddate of the current record. How can I modify my query?
CWOs=[SELECT Id, Status, location.Name, createddate FROM WorkOrder WHERE location.Name = : getwo().location.Name and id != : getwo().id and recordtype.name = 'Child' and createddate = LAST_N_DAYS:30 ORDER BY CreatedDate asc];