Internal Server Error when doing SOQL query of formula field using an encrypted Date/Time field
Last updated 2020-06-11 ·Reference W-4670657 ·Reported By 21 users
When doing SOQL query of the formula field referring an encrypted field, it results in an internal server error of exception : common.exception.SfdcSqlException: ORA-00932: inconsistent datatypes: expected CHAR got DATE
This issue can be seen in various ways depending on where SOQL query is used. An example of implementation is when using a VF email template with a controller doing the SOQL query on fields using encrypted field.
In Platform Encryption enabled Dev org, Add "Manage Encryption Key" user permission to admin user.
Go to Setup - Security Controls - Platform Encryption, generate tenant secret.
1. On Case Object, create Custom field of type Date/Time Date2
2. Create custom formula field of type Date/Time: Date1 and refer Date2 as formula
IF(ISBLANK(Date2__c) = FALSE, Date2__c,CreatedDate )
3. Encrypt Date2 field.
4. Do SOQL SELECT Date1__c, Date2__c FROM Case
UNKNOWN ERROR: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 2072669768-50234 (1445901260)
In Dev console,
[object Object]: An unexpected error occurred. Please include this ErrorId if you contact support: 1894147367-48779 (-1458846590)
common.exception.SfdcSqlException: ORA-00932: inconsistent datatypes: expected CHAR got DATE
Query should be successful and return results
None at this time.
Reported By (21)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.