- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
12-14-2012 06:15 AM
I can retrieve any records with this query. It is an issure with the Date format. Is lastmodifieddate a date or datetime? If i remove the LastModifiedDate >=:d AND LastModifiedDate <=:c filter the query works just fine.
Date d = system.Today().addDays(-3);
Date c = system.Today().addDays(-5);
//collect a list of records
List<Lead> setfollow = [SELECT Id, OwnerID, status FROM Lead WHERE LastModifiedDate >=:d AND LastModifiedDate <=:c AND Map_Record_Type__c = 'Contract/Direct Customer' AND IsConverted = FALSE AND status IN('Qualified', 'Prospecting')];
Im trying to get a list of leads that havent been modified in 4 days.
I already tried:
Date d = system.Today().addDays(-4)
and bind it with the query but nothing shows up.
12-14-2012 06:30 AM
LastModifiedDate is a DateTime (despite the moniker). Use a DateTime function instead, or use date literals:
LastModifiedDate >= LAST_N_DAYS:5 AND LastModifiedDate <= LAST_N_DAYS:3
See the Web Services Developer's Guide section on Date Literals for more details.
~ sfdcfox ~
I am a sandwich. That is all.
12-17-2012 08:09 AM
Tried using literals, couldn't get them to fit my needs..... i changed the query around and took out the "=" operator. Workk for now.
I appreciate the help sfdcfox.