20 Common Errors in Salesforce With Resolution 1720015105
20 Common Errors in Salesforce With Resolution 1720015105
20 Common Errors in Salesforce With Resolution 1720015105
in Salesforce with
Resolution
#kb_sfdc_content
1. System.LimitException: Too many SOQL queries:
- This error occurs when the code executes more than 100 SOQL queries in a single transaction. To
resolve it, optimize your code to reduce the number of SOQL queries or use aggregate queries where
possible.
- This error indicates that a SOQL query returned no results when you were expecting at least one. To
resolve it, check if the query conditions are correct and handle scenarios where no records are found.
#kb_sfdc_content
3. System.NullPointerException:
- This error occurs when you try to access or perform operations on a null object reference. To
resolve it, ensure that the object or variable you are accessing is not null before performing operations
on it.
- This error occurs when a DML operation (insert, update, delete, or undelete) fails. To resolve it,
check for validation rules, triggers, or other factors that might be preventing the DML operation from
succeeding.
#kb_sfdc_content
5. System.CalloutException: You have uncommitted work pending:
- This error occurs when you try to make a callout after performing a DML operation in the same
transaction. To resolve it, perform callouts in a separate transaction using future methods or queueable
Apex.
- This error occurs when you try to assign a list to a map or vice versa. To resolve it, ensure that you
are using the correct data structure and perform the necessary conversions if needed.
#kb_sfdc_content
7. System.LimitException: Apex CPU time limit exceeded:
- This error occurs when the CPU time limit for Apex code execution (10,000 milliseconds) is
exceeded. To resolve it, optimize your code for efficiency and consider using asynchronous processing if
possible.
- This error occurs when you try to update a field that is read-only. To resolve it, check the field-level
security settings and validation rules to ensure that the field can be modified.
#kb_sfdc_content
9. System.UnexpectedException: Salesforce System Error:
- This error indicates an unexpected internal error in Salesforce. To resolve it, report the issue to
Salesforce support and provide details of the error for investigation.
- This error occurs when parsing JSON data and it is not in the expected format. To resolve it, validate
the JSON data and ensure that it conforms to the expected structure.
#kb_sfdc_content
11. System.LimitException: Apex heap size too large:
- This error occurs when the heap size limit (6 MB) for Apex code execution is exceeded. To resolve it,
optimize your code to reduce memory consumption, such as by using collections efficiently and
minimizing data processing.
- This error occurs when an update operation fails for a specific record. To resolve it, check for
validation rules, triggers, or other factors that might be preventing the update from succeeding.
#kb_sfdc_content
13. System.QueryException: Non-selective query against large object type (more than 200000 rows):
- This error occurs when a SOQL query against a large object type (more than 200,000 rows) is not
selective. To resolve it, ensure that the query has selective filter criteria to improve performance.
14. System.AsyncException: Future method cannot be called from a future or batch method:
- This error occurs when you try to call a future method from another future method or batch
method. To resolve it, ensure that future methods are not invoked recursively or from within
asynchronous contexts.
#kb_sfdc_content
15. System.SecurityException: You do not have sufficient privileges to perform this operation:
- This error occurs when the current user does not have the necessary permissions to perform a
specific operation. To resolve it, check the user's profile, permission sets, and sharing settings to ensure
they have the required privileges.
- This error occurs when the total memory heap size for Apex code execution exceeds the limit (6
MB). To resolve it, optimize your code to reduce memory usage, such as by limiting the size of
collections or processing data in smaller batches.
#kb_sfdc_content
17. System.CalloutException: Read timed out:
- This error occurs when a callout takes longer than the maximum allowed timeout (10 seconds). To
resolve it, optimize the callout operation to reduce response time or increase the callout timeout if
necessary.
- This error occurs when attempting to send an email with an invalid recipient email address. To resolve
it, validate the recipient email addresses and ensure they are in the correct format.
#kb_sfdc_content
19. System.JSONException: Unexpected character ('<' (code 60)):
- This error occurs when parsing JSON data and encountering unexpected characters, such as HTML
tags. To resolve it, ensure that the JSON data is properly formatted and does not contain unexpected
characters.
- This error occurs when making callouts in a recursive or deeply nested manner, exceeding the
maximum callout depth limit (3). To resolve it, refactor the code to avoid recursive callouts or limit the
depth of callout chains.
#kb_sfdc_content
#kb_sfdc_content