You need to sign in to do that
Don't have an account?
mikka
Help!! How to compare two date fields
Hi guys, I am trying to compare two date fields in SF schema and is getting a malformed query error. Can anyone help me how to compare this two date fields please??? My SOQL query is like this: Select c.Status, c.SR_Number__c, c.Id, c.Due_Date__c, c.CreatedDate, c.CaseNumber From Case c where CreatedDate = Due_Date__c I just want to compare if the Created Date has the same date (YYYY-MM-DD) with my due date. Your help will be greatly appreciated. Thanks!!!
You can't compare one field with another as part of the where clause. The right hand side of the expression must be a native value. Its documented here:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_fieldexpression.htm
mikka,
One way to handle this is to create a formula field which which returns TRUE if the condition satisfies else false. Then in the SOQL, just refer the <Formula Field> = TRUE in the where clause.
Thanks guys!!! I'll check that one out. I'll also add another trigger to regularly update the boolean comparison since my due date field values always vary whenever updated. Thank you so much again..