The Salesforce Winter Release 2025 introduces changes that may affect existing Apex code relying on older SOQL error messages and functionality. This update is especially important for developers working with dynamic SOQL queries, as it impacts how error messages are generated and handled. Review these changes and adjust your code accordingly to ensure compatibility and optimal performance.
Applicability
These changes apply to all Salesforce editions.
Key Updates
1. Support for Negative Currency Values in Dynamic SOQL Queries
-
- Example:
SELECT Name FROM Invoice__c WHERE Balance__c < -USD500
- Example:
2. Updated Error Messages for Invalid Dynamic SOQL Queries
-
- Example 1:
SELECT Id FROM Account USING everything
- Old: unexpected token: ‘<EOF>’
- New: unexpected token: ‘everything’
- Example 2:
SELECT ParentId, Value FROM InteractionRefOrValue WHERE ParentId IN ()
- Old: unexpected token: ‘)’
- New: unexpected token: ‘ParentId IN ()’
- Example 3:
SELECT FROM ServicePresenceStatus
- Example 1:
-
-
- Old: unexpected token: ‘FROM’
- New: unexpected token: ‘SELECT FROM’
- Example 4:
SELECT Id from $casecomment WHERE isdeleted = false
- Old: line 1:15 no viable alternative at character ‘$’
- New: line 1:15 unexpected token: ‘$’
- Example 5:
SELECT lastmodifieddate, companyna fr$om user
- Old: unexpected token: user
- New: missing value at ‘user’
-
3. Error Messages with Quotes Around Unexpected Tokens
-
- Example:
SELECT annualrevenue , parentid FROM Account WHERE (isDeleted = false AND NumberOfEmployees != 100) OR (isDeleted = false AND Site = '999') AND ParentId = '000000000000000' LIMIT 50000- Old: unexpected token: AND
- New: unexpected token: ‘AND’
- Example:
4. Using NULL Literals with LIKE Keyword
-
- Example:
SELECT Id, Name, Country__c, State__c, City__c, PAN_Number__c FROM Account WHERE PAN_Number__c LIKE NULL AND Name LIKE '%a%'
- Old: invalid operator
- New: unexpected token: ‘NULL’
- Example:
5. Nested Functions in Dynamic SOQL Queries
-
- Example:
SELECT convertCurrency(calendar_year(convertTimezone(lastmodifieddate))) FROM account
- Old: expecting a right parentheses, found ‘(’
- New: unexpected token: ‘‘(’’
- Example:
6. Invalid Datetime Literals
-
- Example 1:
SELECT Id FROM Account WHERE SystemModstamp > 2020-12-12t12:12:00-25:00
- Old: line 1:67 mismatched character ‘5’ expecting set ‘0’..’3′
- New: Invalid datetime: 2020-12-12t12:12:00-25:00
- Example 2:
SELECT Id FROM Account WHERE SystemModstamp > 2020-52-12t12:12:00-05:00
- Old: line 1:51 no viable alternative at character ‘5’
- New: Invalid datetime: 2020-52-12t12:12:00-05:00
- Example 1:
7. Bind Variable Issues in Dynamic SOQL Queries
- Example:
SELECT Id FROM Custom_User_Attribute__c WHERE User__c =:0050W000007Jz7jQAC
- Old: Only variable references are allowed in dynamic SOQL/SOSL
- New: unexpected token: ‘0050’
Conclusion
These changes in the Salesforce Winter Release 2025 emphasize the need for developers to remain proactive in understanding system updates. Adjusting your Apex code to align with the latest SOQL error handling ensures better functionality and minimizes disruptions in your Salesforce environment. Staying informed is key to optimizing your development workflow.
Learn Moar!
For detailed release notes and additional resources, visit the Salesforce Release Updates page. Keep following SalesforceMonday.com for expert tips, tutorials, and the latest news on Salesforce development.
Leave a Reply