86
votes
Accepted
LWC navigation error: "this[f.NavigationMixin.Navigate] is not a function"
Apply the NavigationMixin function to your component’s base class:
export default class MyLwcComponent extends NavigationMixin(LightningElement) {
Hopefully this saves 3 mins of searching for those ...
46
votes
When do we really need try/catch?
What the main point of try/catch?
To catch and handle an exception. The handling is the key.
What it means to handle an exception is to take an exceptional situation - something bad and out of the ...
18
votes
When do we really need try/catch?
always in DML operations
That's a common misconception. If you're using partial saves (e.g. Database.insert(records, false);), there's never a time where you need try-catch, as any exception is ...
13
votes
Accepted
Do 2GP Managed Packages send email notifications on unhandled Apex errors?
Yes, unhandled exception emails do work with 2GP.
I confirmed this by creating a managed 2GP with a Visualforce Controller that tries to divide by zero if a certain custom metadata record is set to ...
12
votes
Accepted
Best practice for catching and displaying action errors in Lightning components
What I use is a component which handles those calls and turns errors into toasts:
ToastErrorHandler.cmp:
<aura:component >
<aura:method name="handleResponse" action="{!c.handleResponse}"...
11
votes
Accepted
NUMBER_OUTSIDE_VALID_RANGE: value outside of valid range on numeric field: 100.0
Precision is the total number of digits allowed both left and right of the decimal, and scale is the number of digits to the right of the decimal. The number of digits just to the left of the decimal ...
10
votes
Accepted
Data Loader Error no viable alternative at character
You are only allowed to use single quotes in your query. Replace all of your double quote characters (") with single quote characters (').
10
votes
Accepted
Is it a good practice to set debug points in possible failure points in our Apex code?
Setting just system.debug won't help you much since in orgs where your package is installed might have lot of other codes that might lead to logs truncation and your debug statements getting lost.
...
9
votes
How to resolve an "Unknown user permission: SendExternalEmailAvailable" deployment error
Set Email Deliverability to 'All Email':
For unknown reason Salesforce automatically creates and removes this permission completely behind the scenes on all profiles based on the value of this ...
9
votes
Accepted
lightning:input Clear validation error messages
we had a similar requirement and the way we fixed it was to put the entire form inside an aura:if and changed the Boolean condition. this essentially meant the dom got re-created again but we were ...
9
votes
Accepted
LWC: How to get access to proper Error message when statically calling an Apex method from LWC?
You don't have to throw AuraException, instead, you have to throw
AuraHandledException (for Aura components only)
AuraHandledException (for LWC components)
@AuraEnabled
public static string ...
8
votes
How to resolve an "Unknown user permission: SendExternalEmailAvailable" deployment error
This relates to the "Send through External Email Services" setting in Setup. Go to Setup > Email Administration > Send through External Email Services to see the setting. According to the description ...
8
votes
Accepted
Triggered Send Error Code: 138 - Exceeded Expiration Policy
This occurs when the subscriber was in the triggeredsend queue for more than 3 days.
The triggeredsend can queue do the following reasons:
TS erred causing the job to be stopped and the subscribers ...
8
votes
Accepted
Salesforce Error Publishing Community 1715759908
Salesforce Support got back to me and they said that this was most likely caused because during the deployment, Navigation Menu Item records were created without having a DraftRowId set.
As a solution:...
7
votes
Accepted
UNABLE_TO_LOCK_ROW error
Even though you have a record ID, if you try an update, a lock must be acquired first. Using FOR UPDATE forces the system to wait while it can acquire a lock on the record. It is recommended that you ...
7
votes
Accepted
Unexpected token `<`. in Apex trigger
The problem is with how you are looking to reference the trigger.new context.
The binding expression : must be used as follows.
trigger AccountAddressTrigger on Account (after insert, after update) {...
7
votes
Accepted
AddError on an object in a trigger is only displaying one of the errors in object list view
It's a limitation of the addError interface. You are allowed at most one record-level error and one field level error per field. Adding a subsequent error will replace the original. This is also not a ...
6
votes
How to debug the mysterious "duplicate value found: <unknown> duplicates value on record with id: <unknown>" error
After many hours trying to look for every single issue mentioned on this page, and getting so angry about the lack of useful error messages in DX I was reminded that deployment settings may give more ...
6
votes
Accepted
Icon maximum length error during deployment
The error message is misleading.
The error was because the image file AllocationLogo.png was not present in Shared Documents.
Once I uploaded the file to shared documents, the deployment went ...
6
votes
Complete list of Standard Field Validation Error Messages
The strings are version and language dependent. However, there is a way to find which codes are valid for a particular release: go into Setup > Develop > API, generate the Enterprise WSDL, and find ...
6
votes
Accepted
Display Apex Exception message nicely in Lightning toast
Adding ugly wrapping code to all my @AuraEnabled methods seemed not to be an acceptable clean solution to me...
@AuraEnabled
public static Id myAction() {
try {
// regular action code
}
...
6
votes
Accepted
Displaying an error message on a visualforce page
You need to rerender pageMessages section by commandButton's attribute
<apex:pageBlock>
<apex:pageMessages id="msgId"/>
<apex:commandButton name="Submit" action="{!exchangeInv}...
6
votes
Accepted
RaiseError not logging Error message into DE
AMPScript does not have any named parameters, so all parameters must be passed by position. In this case, the RaiseError function has 5 parameters and you are trying to specify the 5th without ...
6
votes
Accepted
Issue when using JSENCODE
accRegNumber is a JavaScript variable. The Salesforce formula expression {!JSENCODE(accRegNumber)} is processed by the server long before the content reaches the JavaScript parser, and the server ...
6
votes
How to use Lightning-Record-Form onError to display custom error message
Okay, so thanks to @sfdcFox I realized that the error handling override in the lightning-record-form is not able to be canceled, so I just used a combination of lightning-record-edit-form and ...
6
votes
How do I do a universal SOQL?
You can make use of dynamic SOQL:
String type = 'Abc__c';
Map<Id, SObject> m = new Map<Id, SObject>(Database.query('SELECT Id FROM ' + type));
Also see the SObject documentation for ...
6
votes
Accepted
How do I do a universal SOQL?
It is possible to get the object's type from the ID then use this in the dynamic SOQL. For example:
Id id = Id.valueOf(tool.cId__c);
String objectAPIName = id.getSobjectType().getDescribe().name;
...
6
votes
When do we really need try/catch?
It seems you have some misconceptions about exceptions.
I don't know if I'd say that all DML operations should be inside of a try block
Exceptions can contain useful information for debugging, but if ...
6
votes
Accepted
How can I change the version of a Flexipage through SFDX?
Change the target API version in your sfdx-project.json file, for example:
{
"packageDirectories": [
...
],
"sourceApiVersion": "48.0"
}
6
votes
Marketing Cloud SQL - Invalid Column name "Opt"
The problem is that SQL has trouble with the - in a field name.
Just make sure it understands it by wrapping the fieldname in brackets. In general, just don't use "-" in fieldnames and it ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
error-messages × 503apex × 151
visualforce × 76
trigger × 60
error × 58
lightning-aura-components × 33
marketing-cloud × 20
lightning × 19
javascript × 19
visual-workflow × 19
lightning-web-components × 17
validation × 14
unit-test × 13
deployment × 13
validation-rule × 13
soql × 12
controller × 11
managed-package × 10
exception × 10
pagemessages × 10
adderror × 9
before-trigger × 8
api × 7
formula × 7
opportunity × 7