PRODUCTION SUPPORT – COMMON ERRORS IN SALESFORCE
The following common errors we will come across when we are in production support. Plz let me know if you need any further explanation in detail.
The ID must begin with / error in Salesforce
This error occurs when action attribute value is wrong.
action=”{!methodName}” is correct.
action=”methodName” is wrong.
Unable to get values from __r Reference in a trigger
In a trigger we cannot get parent record or child record values using __r notation.
The work around for this is we have to get the parent records or child records using the trigger.newMap.keySet().
Sample Code:
List List = [SELECT Name, Id FROM ChildRecord WHERE ParentObject__c IN : trigger.newMap.keySet();
Why we will get an “obsolete report” error message in Reports in Salesforce?
You may see this error because:
An object in the report isn’t enabled for reporting anymore.
A lookup relationship used by objects in the report has been deleted or modified.
An object in the report has been deleted.
You don’t have “View” permissions for an object in the report.”
With Data loader using “Upsert” operation performed over 10 records which includes 3 records as ABC,ABC,ABC. Will it throw any error?
Yes it will throw duplicate external ids found error.
System.LimitException: Too many DML rows: 10001
System.LimitException: Too many DML rows: 10001 error occurs, when we try to do DML operations to more than 10000 records at a time. If we want to do DML operations to more than 10000 records at a time, we have to call a batch class from the current class to handle it separately.
Newly deployed fields missing issue in Salesforce
After deploying the fields and after adding those fields to the page layout, sometimes it will not be available to the users. This is mainly due to Field Level Security.
So, after deploying the fields, we have to deploy the profiles or else we have to set the Field Accessibility.
Incorrect Parameter type for operator ‘&’ error in formula field in Salesforce
This error occur when you are trying to concatenate two fields values into a single formula field or just populating a value from a field in Formula Field which is not returning text.
To avoid this error, use TEXT() method.
Example:
TEXT(CreatedDate) & TEXT(Age__c)
here CreatedDate is a Date Field and Age__c is Number Field.
TEXT() method should be used even in case of Picklist Field.
Too many DML statements: 1 out of 0 Error in Salesforce
In tag, if attribute “readonly” is true and if we try to execute DML statements(Insert, Update, Delete), then it shows Too many DML statements: 1 out of 0 Error in Salesforce.
So, in order to rectify this error, set readOnly = “false” or remove this attribute in tag.
Sample code:
MIXED_DML_OPERATION error in Salesforce
You can easily run into this error if you are trying to perform DML on setup and non-setup objects in the same transaction.
Non-Setup objects are standard objects like Account or any custom object.
Setup objects are Group1, GroupMember, QueueSObject, User2, UserRole, UserTerritory, Territory, etc..
For example, you cannot insert an account and then insert a user or a group member in a single transaction.
Test methods allow for performing mixed DML operations between the sObjects listed earlier and other sObjects if the code that performs the DML operations is enclosed within System.runAs method blocks. This enables you, for example, to create a user with a role and other sObjects in the same test.
Invalid Date error in Apex
Use the below format for the date to avoid this error.
yyyy-mm-dd
Example:
String a = ‘2013-02-14′;
Date d = Date.valueOf(s); // It won’t show invalid date error.
Record is read-only error in Apex Trigger
Field update cannot be done after the record has been Updated/Saved.
So, use after insert or after update as the trigger events.
Error import com.sforce.soap.enterprise
Its a common error in Webservice api.
To avoid this error, you have to use the below syntax to create enterprise.jar.
Code:
java –classpath pathToJAR/wsc-20.jar com.sforce.ws.tools.wsdlc pathToWsdl/WsdlFilename
pathToJar/JarFilename
Example:
java -classpath wsc-20.jar com.sforce.ws.tools.wsdlc enterprise.wsdl.xml enterprise.jar
The above code generates a jar file named ‘enterprise’.
You should include this jar file to avoid errors.
In order to overcome ‘URL No Longer Exists.
You have attempted to reach a URL that no longer exists on salesforce.com’ error, avoid using ‘/’ at the end of the URL.
Correct Code:
pageReference pg = new pageReference(‘/apex/ExportAsCSV’);
pg.setRedirect(true);
return pg;
Incorrect Code:
pageReference pg = new pageReference(‘/apex/ExportAsCSV/’);
pg.setRedirect(true);
return pg;
‘/’ should not come at the end.
Cannot Reference Converted lead error
This error means that the Lead record has been converted.
Once converted, the Lead record cannot be updated.
The Lead object has an IsConverted property. Using that you can check to whether lead has been converted.
Collection size exceeds maximum size of 1000 error
It means List, Set & Map size exceeds 1000.
To avoid this, use wrapper class and get set of first 1000 records, save it and then retrieve the next and so on.
Unable to add Value field in Dashboard settings for Tabular report
The value field can be anyone of the following data types
1. Number
2. Currency
3. Boolean
Insufficient access rights on cross-reference id error
When you try to update the data, you may face this issue. Kindly check the user profile and check whether the user has access to update that record. Even if the user has access, kindly check whether the user has access to update fields like record types.
Troubleshooting steps: 1) Check the user Profile.
2) Profile need to have access for the record types.
Parser was expecting element Data Loader Login issue
In order to avoid “Parser was expecting element” error in data loader, kindly check the following settings in Apex Data Loader
1. Check whether you have given the proxy correctly.
2. Check whether you have given the port number correctly.
3. Check whether you have given the correct url(for Production – https://login.salesforce.com and forSandbox – https://test.salesforce.com).
4. Make sure “API Enabled” permission is checked on the Profile.
Record is read-only error in Apex Trigger
Field update cannot be done after the record has been Updated/Saved.
So, use after insert or after update as the trigger events.
Comments
Post a Comment