You need to sign in to do that
Don't have an account?
N.igu
value of filter criterion for field 'IssueDate__c' must be of type date and should not be enclosed in quotes
Please tell me the wrong place.
Error ”must be of type date and should not be enclosed in quotes”
// WHERE private String getWhere(){ List<String> param = new String[]{ }; // From if(this.obj.IssueDateStart__c <> null){ Datetime fromDate = adjustJSTtoGMS(obj.IssueDateStart__c); param.add('IssueDate__c >= ' + fromDate.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'')); } // To if(this.obj.IssueDateEnd__c <> null){ Datetime toDate = adjustJSTtoGMS(obj.IssueDateEnd__c); param.add('IssueDate__c <= ' + toDate.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'')); } if(param.isEmpty()){ return ''; } return 'WHERE ' + String.join(param, ' AND '); } private DateTime adjustJSTtoGMS(DateTime day){ JST_AM0 = Time.newInstance(15, 0, 0, 0); return Datetime.newInstance(day.date(), JST_AM0); }Execution result
value of filter criterion for field 'IssueDate__c' must be of type date and should not be enclosed in quotes
Please tell me the wrong place.
I have gone through your code, implemented the same and found out that if I remove adjustJSTtoGMS(obj.IssueDateStart__c) from line 7 and adjustJSTtoGMS(obj.IssueDateEnd__c) and add simple DateTime.newInstance() from 12 code works. So:
1. Either you have a problem in your adjustJSTtoGMS () method, (little doubt on JST_AM0, try replacing it with Time someVariable),
2. OR There is some problem with format while accessing obj.IssueDateStart__c and corresponding date as well so try printing them before you set.
3. Try commenting out Start and End date (one by one) to have a more significant view to problem.
4. Ensure data type of obj.IssueDateStart__c and obj.IssueDateEnd__c are correct.
Please go through following points (specially the first one) and please update if anything positive happens.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
All Answers
not error
SELECT Id FROM Account WHERE StartDate > fromDate
I have gone through your code, implemented the same and found out that if I remove adjustJSTtoGMS(obj.IssueDateStart__c) from line 7 and adjustJSTtoGMS(obj.IssueDateEnd__c) and add simple DateTime.newInstance() from 12 code works. So:
1. Either you have a problem in your adjustJSTtoGMS () method, (little doubt on JST_AM0, try replacing it with Time someVariable),
2. OR There is some problem with format while accessing obj.IssueDateStart__c and corresponding date as well so try printing them before you set.
3. Try commenting out Start and End date (one by one) to have a more significant view to problem.
4. Ensure data type of obj.IssueDateStart__c and obj.IssueDateEnd__c are correct.
Please go through following points (specially the first one) and please update if anything positive happens.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi