Questions tagged [exception]

An exception denotes an error that disrupts the normal flow of code execution.

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

Change data capture event not firing associated trigger in production

I have a custom trigger that fires on an OpportunityChangeEvent: trigger EXAMPLE_CREATE on OpportunityChangeEvent(after insert) { // Get the change event’s product ID for added and updated products ...
1
vote
1answer
64 views

multiple addError() behaviour in apex

We have a trigger on the Account and Contact objects. The job of these triggers is to prevent the deletion of Account and Contact objects depending on the criteria. Account should be deleted if no ...
2
votes
1answer
39 views

Method not getting called after addError, Please advise

I am new to SFDC please help. Requirement: Restrict user deactivation if Account is owned by the user and send an Email with details. Trigger on user object: trigger userTrigger on User (before ...
0
votes
1answer
57 views

JS Promise.all and a combination of failed and successful Apex calls: how to deal with that?

In the controller of a LWC, we use Promise.all to call an Apex method with different inputs. The code for this: const funcs = productCodesBatches.map(productCodesBatch => getSearchResultsBatch( { ...
0
votes
2answers
70 views

CPU Timeout Error for 9k records after resolving Too many DML rows: 10001

What do I have? Two objects ObjectA and ObjectB without any trigger/process builder/flow. I create a trigger on ObjectA to create the same number of records on ObjectB What is my test case? Insert ...
0
votes
1answer
33 views

Facing Mixed DML operation for apex class

I have written a scheduler for deactivating salesforce users who doesn't logged in for last 90 days. The code is working as expected if I remove exception logging into a salesforce object at line #14. ...
0
votes
1answer
41 views

Logging Apex exceptions through Event Bus while still rolling back the entire transaction?

I'm working on implementing a robust error logging framework for our org using Platform Events to ensure that we always capture errors in our code even if the transaction is rolled back. If I use ...
-2
votes
2answers
62 views

Apex error : You have uncommitted work pending. Please commit or rollback before calling out [duplicate]

Apex error : You have uncommitted work pending. Please commit or rollback before calling out. I get the above error when I try to make two http callout one after the other and store the result in ...
0
votes
1answer
30 views

AuraHandledException message: extra word (“Exception”) at beginning of message

I am working on a component+Apex class. I need to throw an error message via AuraHandledException. Everything seems to be working fine except for the error message itself: it's showing up with an ...
1
vote
1answer
84 views

Apex safe navigation operator chaining

I'm a little bit confused. Let's say we have a code String[] recordTypes = AppConfigData__c.getValues('dummy')?.value__c.split('\\s*;\\s*'); Why it works even if getValues() returns null? Why split ...
0
votes
0answers
28 views

getContent() throws ApexPagesGenericException 404

When trying to retrieve a json file from a zip file, I get the following error: Error: System.VisualforceException: core.apexpages.exceptions.ApexPagesGenericException: 404 status code return from ...
2
votes
1answer
36 views

Latest on reviewing errors in a managed package

I know this has been discussed before but all of the threads are several years old. I couldn't find a finite answer and also I am trying to find out if anything has changed since. I am trying to ...
1
vote
0answers
33 views

Updating Opportunity Splits in Apex field integrity exception

I'm trying to automate Opportunity Splits and I'm running into the following when trying to upsert them for a given split type: System.DmlException: Upsert failed. First exception on row 0 with id ...
0
votes
1answer
28 views

Prevent a rollback of an inserted record due to an exception [duplicate]

I have a LWC component which calls an apex class that does callout: public static List<Case> doCallout(List<Case> cases) { ....... CalloutLogger.insertLog(req, res, time); ........
0
votes
1answer
39 views

LWC - Exception when calling child function more than once

I'm having an issue while developing an LWC and was hoping someone could help as the error isn't super clear to me. I have LWC A which contains LWC B (check example code below): <div ...
0
votes
1answer
51 views

Throw an exception in Apex if attachment is null

I have a Visualforce form that takes attachments of which I need to make required in order for the user to proceed to the next screen. Since the record doesn't get inserted until the end of the multi-...
0
votes
1answer
29 views

How to get the inner exception?

So I catch a DMLException which is caused by a custom exception from a managed package, now how can I get that custom exception? Here is the log: 18:33:24.391 EXECUTION_STARTED ... 18:33:25.710 ...
0
votes
0answers
17 views

Catch exception inside record-triggered flow and provide custom message instead of standard

Let's say we have record-triggered flow that updates unique field. Is it possible to provide custom error message when flow faced DUPLICATE error ?
2
votes
3answers
336 views

try catch finally and inserting records

We have an error log object where we store the errors and I have a simple try catch like below... My issue is that the insert in the finally does not appear to be happening. Any advice? or is that a ...
0
votes
0answers
132 views

Why aren't I receiving flow error emails in my sandbox?

I have a Process Builder that is failing to complete when a record is created, when I attempt to create the record a failure message is returned "We cant save this record because PB-NAME has ...
0
votes
1answer
57 views

How can I avoid error “sObject type 'StaticResource' is not supported.” in the Post Install script?

I am sampling data inside the Package Post Install script from a Static Resource, but script fails with an error: Error Message: common.apex.runtime.impl.ExecutionException: sObject type '...
0
votes
1answer
69 views

Handling errors in the Flows

I have a simple flow which jsut updates the record. But when updating the records if it fails the users were getting unhandled error exception. Like below An unhandled fault has occurred in this flow ...
0
votes
1answer
39 views

Is there something similar to Add Error that doesn't prevent DML Operation

How can I do something similar to id.addError without preventing dml operations? Long story short, I have a screen flow that updates a Case record and I want to be able to tell users that the ...
0
votes
1answer
57 views

System.TypeException: Invalid conversion from runtime type List<ANY> to Map<String,ANY>

I'm writing test class for one of my method and getting this error: Method: public String onLoadLog(String loaddata) { Map<String, Object> LogData = (Map<String, Object>) JSON....
0
votes
1answer
130 views

Exception Handling in Auto Launched Flows

Account accountRecord =[Select Id From Account Where Id='001ABCABCABCABYAAQ']; The above code results in an Exception(System.QueryException) in Apex as there is no Account with the given Id. But it ...
0
votes
1answer
62 views

Execution of BeforeUpdate caused by: System.FinalException: SObject row does not allow errors ()

I have created a trigger on the Opportunity object for before insert and before update, through which I am sending the Trigger.newMap variable as an argument to my apex class where I am checking the ...
0
votes
0answers
79 views

Unknown exception in SendMail method: List index out of bounds

I am facing the current error with the Messaging.sendEmail method: Error Occurred: An Apex error occurred: System.EmailException: SendEmail failed. First exception on row 0; first error: ...
0
votes
1answer
14 views

exceptions and scheduled jobs

I know if there is an unhandled exception it will "roll back" any dml operations that occurred during the same transaction. Does this also include scheduled jobs? I'm not sure if scheduling ...
0
votes
1answer
21 views

Visualforce behaviour when expections are caught

I made a really weird discovery and i wanna ask if this is true and how to handle those situations. If a VIsualforce page invokes an Apex method via commandButton or acionFunction, if an exception was ...
1
vote
0answers
35 views

System modify all data permission does not seem to be working

I am trying to update activities (tasks) using the bulk API utilizing a client. It seems to be working however I am getting a few thousand records that are returning an error : Unknown_Exception: An ...
1
vote
1answer
87 views

MIXED_DML_OPERATION : Can not insert a user record from account trigger even when User Role is null

I am trying to create a community user in an after update trigger of account. I am setting the UserRoleId = null but still am getting MIXED_DML_OPERATION exception. As per documentation: You can ...
0
votes
0answers
26 views

How can I find out what “uncommitted work” is allegedly pending?

I have two schedulable batch processes, identical in every way except one is for Opportunity and the other is for Appointment__c. In real life, both batch processes work exactly as expected, which is ...
2
votes
1answer
80 views

Stubbing Logger classes with methods accepting Exceptions

I recently needed to write a test that checks if an exception gets logged. We have a Logger but it's built with static methods, so it cannot be stubbed. But I didn't want to test the Logger logic, so ...
-1
votes
2answers
65 views

System.QueryException: Implementation restriction: ContentDocumentLink?

I have been following this to create a lightning component for lighting:file upload. As you can see there's comments on how to avoid the System.QueryException yet I still am getting it? picture of ...
4
votes
1answer
156 views

Do we really need to wait up to 24 hours for Apex Exception Emails?

For a feature I am working on, I've been instructed to handle errors by sending emails using the Apex Exception Emails, so when an error occurs, I'm "handling" it by throwing a custom ...
0
votes
0answers
112 views

Batch Apex Too many SOQL Queries: 201 on a relationship query

REQUIREMENT Create a batch apex class that needs to update all of the accounts based on the number of contracts and opportunities for that certain account. Here is what I have so far. However, I am ...
1
vote
1answer
400 views

Error deploying LWC in change-set. Programmer error: Cannot compare savepoints from two different transactions

I have two Lightning Web Components that consistently fail when I try to deploy them in a change-set. The two LWC are the only components being added in the CS and the error is consistent. Everything ...
5
votes
2answers
190 views

Salesforce Exception Emails Don't Send

Several months ago, we noticed that our production org was not sending exception emails though we regularly were able to generate an exception email in sandboxes. We filed a case with support and ...
1
vote
2answers
247 views

Query Exception : Non-selective query against large object type (Even with the correct way of handling)

I am getting System.QueryException: Non-selective query against large object type (more than 200000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field ...
0
votes
0answers
54 views

Access Named Credentials with merge fields [duplicate]

I am on a task where I need to call an external webservice that takes the username and password in the request body, not as part of Authorization header. I did setup the username and password using ...
0
votes
1answer
16 views

Running describeReport(3-arg); of Salesforce Reports and Dashboard API, gives an error(in the SS). Any idea why could this be happening?

------------------------------------------------- Please consider following before answering: The same code runs when invoked through anonymous code window in devConsole. "Run reports" ...
1
vote
1answer
84 views

DML in loop in a batch process

I was working on something entirely different, wrote a test code and found a gap in my knowledge. Hoping someone can point out where and why my understanding is wrong. I have a batch job, it queries ...
0
votes
1answer
2k views

TRANSFER_REQUIRES_READ, The new owner must have read permission: []

I am getting this error while changing the owner of a record by the selected user. So basically I don't want to change an owner or show a custom error message if the user do not have access or which ...
0
votes
0answers
24 views

Custom Exception

I have started learning custom exception. I try to display only the exception message for my program. my code: public class AccountContactHandler { public List<AccountContactWrapper> ...
0
votes
2answers
32 views

System.LimitException: Too many Email Invocations: 11

// Original Code for(Account obj :updateAsDuplicate){ obj.Duplicate__c = true; for(String oldStr : hasExternalIdOldSet){ if(obj.Id.equals(duplicateMap.get(oldStr))){ ...
0
votes
2answers
133 views

“Too many SOQL queries: 201” while running batch - how to fix this code?

I want to test my method and I have this error: FATAL_ERROR|System.LimitException: Too many SOQL queries: 201 Class.PatchPanelTriggerClass.deleteDuplicates: line 202, column 1 Class....
3
votes
0answers
515 views

How to gracefully handle custom Apex exception from Apex Action in a Flow

Prelude We have a button on the Account object which kicks off a Flow whose only job is to call an Apex Action. Inside the invocable Apex class, there is much weeping and gnashing of teeth, after ...
0
votes
1answer
39 views

System.CalloutException when making Apex Callout

I have a Apex Callout like bellow which calls the external System API with OAuth2. I am trying to use the Access token if it hasnt expired and generate one if it is expired and store into a encrypted ...
0
votes
1answer
41 views

Getting a null pointer exception

I was trying to fix a null pointer exception here if(com.Employee__c != null && (mapEmployees.containskey(com.Employee__c) == null || (mapEmployees.containskey(com.Employee__c) != null &&...
0
votes
1answer
40 views

How to construct an exception in Test Class

I want to cover the following lines of code: @TestVisible private void sendEmailToAdminOnFailure(Exception e){ String body = ''; body += 'Failure:--------------->'+e.getMessage(...

1
2 3 4 5
11