Skip to main content
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 ...
Brent Bowers's user avatar
  • 3,162
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 ...
David Reed's user avatar
  • 93.4k
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 ...
sfdcfox's user avatar
  • 500k
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 ...
Vivek M. Chawla's user avatar
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}"...
Aidan's user avatar
  • 13.8k
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 ...
sfdcfox's user avatar
  • 500k
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 (').
Adrian Larson's user avatar
  • 151k
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. ...
Mohith Shrivastava's user avatar
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 ...
sskular's user avatar
  • 583
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 ...
RedDevil's user avatar
  • 7,851
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 ...
Pranay Jaiswal's user avatar
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 ...
abd3721's user avatar
  • 2,182
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 ...
EazyE's user avatar
  • 8,602
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:...
Z33dawg's user avatar
  • 1,431
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 ...
sfdcfox's user avatar
  • 500k
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) {...
TSmith's user avatar
  • 5,062
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 ...
sfdcfox's user avatar
  • 500k
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 ...
JodieM's user avatar
  • 1,195
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 ...
joe's user avatar
  • 506
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 ...
sfdcfox's user avatar
  • 500k
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 } ...
Robert Sösemann's user avatar
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}...
Santanu Boral's user avatar
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 ...
ncv's user avatar
  • 418
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 ...
David Reed's user avatar
  • 93.4k
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 ...
Mitch Spano's user avatar
  • 1,635
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 ...
Keith C's user avatar
  • 137k
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; ...
Phil W's user avatar
  • 37.5k
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 ...
Derek F's user avatar
  • 63.2k
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" }
Phil W's user avatar
  • 37.5k
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 ...
Jonas Lamberty's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible