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

learn more… | top users | synonyms

1
vote
2answers
54 views

String Exception is not being caught?

Some how nothing is being caught. Not sure, but it could be not understanding how exception really works. So I have a method that does everything including querying, than finally does an update to an ...
1
vote
1answer
21 views

How to rollback the operation and display a message after a custom exception?

I have a page using an extension to the standard controller, when the records are saved using the standard save method, an after insert trigger is fired and does some validation, I have created a ...
1
vote
1answer
25 views

Long running, but finite length Apex Callout generates timeout exception: Workarounds?

I am trying to work with a 3rd party service api . One of the methods they have brings in all records which takes a lot of time , about 9 mins ( i tried this using chrome app "Advanced Rest Client"). ...
1
vote
1answer
45 views

List Exception caused by trigger

I have some code in a trigger that works when tested, and works in my sandbox, when I get it into production every time something happens where the trigger should go off, I get this error: Apex ...
2
votes
1answer
41 views

Custom exception thrown

I'm learning the APEX world (coming from the .NET world). Defined a custom exception. In a method (say A()) i'm using a try catch block in which, i 'm calling another method of another class (say ...
5
votes
1answer
43 views

Catch System.AssertException

Is there a way to catch System.AssertException? For example, some class is known to throw assertions in certain cases and it's ok to deal with that on some upper level. But unfortunately ...
1
vote
2answers
56 views

Got DUPLICATE_VALUE exception with value : <unknown> and record id: <unknown> in a batch

I got the following exception on a batch job: System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on ...
3
votes
1answer
24 views

DMLException.getDmlId() returning null

In a batch Apex class, I've wrapped the DML statements in a transaction and try/catch block, looking for DMLExceptions. When I catch the exception and call getDMLId(), it just returns null, which is ...
2
votes
0answers
30 views

Has anyone ever, anywhere, seen the Apex Exception “Cannot set the value of a calculated field”

And no, if you're thinking I'm writing to a formula field, that's not it - read on.... I've been seeing this error sporadically during an upsert on one, and only one, org. Upsert failed. First ...
2
votes
2answers
61 views

Check if a record is in approval process

I´m getting this Exception: System.DmlException: Update failed. first error: ENTITY_IS_LOCKED, the entity is locked for editing: The problem is that i´m updating a case that is locked by an ...
0
votes
1answer
24 views

Statements after the catch block still got executed after an exception occured. Is that normal?

I am making a callout to SAP webservice in order to create a customer in SAP. The customer data is nothing but our Account. Now i am getting an exception "IO Exception: Read timed out". i knew that ...
0
votes
1answer
83 views

Execution of AfterInsert caused by: System.FinalException: Record is read-only: Trigger [duplicate]

I have write a trigger on Company__c. My code ** Trigger DirectOrderRFMS on Company__c(AFTER INSERT,AFTER UPDATE) { FOR(Company__c com : TRIGGER.NEW) { ...
3
votes
2answers
674 views

Put all the code in the try catch block

A helper class will throw a custom exception and which has complex logic. I need to catch this exception when invoking it, so I call this helper class in the try block. I want to ask, is that OK if ...
0
votes
0answers
35 views

Why does Task share using Apex and Salesforce-to-Salesforce throw FIELD_INTEGRITY_EXCEPTION?

We are attempt to share Tasks using Apex but are getting an error on inserting PartnerNetworkRecordConnection: "Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Cannot ...
1
vote
1answer
56 views

Weird Javascript remoting error

I'm using javascript remoting in a SKUID page. Everything has been working fine, but without any code changes all of a sudden I started getting this error: function handleRemoteCall(result, event) ...
4
votes
1answer
27 views

Is DML allowed in the current context?

So I can check for isbatch, isfuture, etc... Is there a way to know if the current context allows DML? We've implemented a exception logging object, but if a class is called from a getter or ...
1
vote
2answers
73 views

No such column EntitlementId on entity Case

We have been using the trigger "Trigger on Email Message " on the link below for more than 2 years without any issues. ...
0
votes
0answers
448 views

Apex Callout Exception: IO Exception: Read timed out

I have Salesforce trigger that triggers either a future method or batch job that does call outs to a SOAP webservice. IF the number of call outs I need to make is one then future method is triggered. ...
0
votes
1answer
57 views

apex:messages vs required=true

I have a requirement where at some places in the visual force page, there should be required fields so I have put this : <apex:inputfield id="selectId" value="{!var.field1__c}" required="true" ...
3
votes
0answers
30 views

Anyone run into this: “DeleteRestrictedByFkException not found in section Exception”

I came across this earlier today while working on a custom VF page and I was trying to delete a record from an object. Seems its stemming from the delete trigger or delete action but the exception ...
1
vote
3answers
77 views

System.NullPointerException: Attempt to de-reference a null object for duraion

I am new to Apex coding. Can someone please help me to resolve the issue. I am trying to automatically display the duration when from and todate is selected. For that i have developed a code in the ...
2
votes
2answers
66 views

Log Exceptions during trigger in a custom object

I need to capture exceptions that happen during trigger executions in a custom object. The conclusion here, is that there is no way to do this. Is it possible to hit a Apex webservice callout which ...
3
votes
1answer
80 views

How to tell specifics about SOAP exception

I'm wondering if there is a way to use specific error information using the Salesforce API and C#. Basically my login attempt is surrounded by a try...catch statement which catches any ...
2
votes
4answers
384 views

SINGLE_EMAIL_LIMIT_EXCEEDED. What does it mean?

What does the exception mean? It does not seem to be related to the Number of email invocations limit because of the following line at the end of the log: Number of Email Invocations: 5 out of 10 I ...
10
votes
4answers
403 views

FIELD_CUSTOM_VALIDATION_EXCEPTION during Unit Test

I have a validation rule, such that setting a Case escalation status to "approved" can only be done via particular users and/or emails via the automated email parser. I have a Unit Test that accounts ...
2
votes
1answer
69 views

Log Callout Exception - Uncommitted work pending workaround

I want to perform 5 callouts and log any callout exceptions as a new case. Since mixing callouts and DMLs is not allowed, I made the logging asynchronous. Unfortunately, an ExecutionException ...
1
vote
3answers
54 views

Governors Limits for reports

I am developing some kind of customized report functions using APEX and VF. As the conditions are quite complex and I need to query different objects even to get a number for one column for my report. ...
3
votes
1answer
41 views

Can you override the single string parameter constructor for Exception?

I want to declare a custom exception class that takes a message and also does some custom tracing: public MyException extends Exception{ public MyException(String msg){ ...
1
vote
1answer
344 views

Way to get around SSL certificate errors when calling an external web service?

I'm using WebServiceCallout.invoke in an Apex class to call an external SOAP web service (namely the SOAP API for Central Desktop). Unfortunately, the external service has an invalid SSL certificate ...
10
votes
1answer
169 views

Bests practices for handling potential errors as a result of time based workflow

Question Any tips or tricks for providing a good user experience when a time-based workflow field update can lead to an exception? Detail For each wrench in the Salesforce toolkit there is often a ...
1
vote
1answer
200 views

Customize Apex Exception Messages from Javascript Buttons

My application has javascript button that call Apex code. Exceptions from web services are sometimes thrown and the user is shown a detailed exception message like this: A problem with the OnClick ...
6
votes
1answer
82 views

Why doesn't SFDC allow MIXED_DML_OPERATIONs anymore?

Okay, I know very well by now that SFDC does not want and often does not allow us simply insert and/or update Setup and/or "Non-setup" sObjects in the same context anymore, something I used to do with ...
3
votes
1answer
161 views

HELP Please - System.Exception: Too many SOQL queries: 101

I have been struggling with this error for the past one month. I have tried everything. We had no issue with this code till a month ago but now it is creating a problem. trigger CreatePayment on ...
1
vote
1answer
61 views

System.UnexpectedException: Implementation restriction: activity aggregate relationships only allow security evaluation for non-admin users

I have trigger which references openactivites and activityHistory objects. This trigger seems to work fine for all admin users but fails for non admin users Here is the error message i get caused ...
7
votes
3answers
708 views

Can I throw an exception in apex and still log the caught exception?

I'm really wrestling with the best error handling strategy. My goal is to handle all exceptions that I can identify, log them to a table in the database, and surface a helpful message about what ...
0
votes
1answer
78 views

I want to catch limit Exception and send an email to user when limit Exception occurred in a apex class? [duplicate]

I have a requirement that when a class meets the governor limits i want to send the mail to the specific user. I want to catch limit Exception and send an email to user when limit Exception occurred ...
0
votes
3answers
593 views

Type System.StringException: Invalid id: N/A Error when trying to make a list of ID's in a custom object controller

So essentially I'm trying to write simple script that, on record creation, will cause users referenced by the record's lookup fields to auto-follow the record in question. To this end, I'm creating a ...
3
votes
2answers
142 views

Some Testing Doubts

i am trying to test my Controller .One doubt is in using Test.startTet and Test.stopTest().i am checking every method in separate unit test . for example static testmethod void ...
3
votes
1answer
282 views

Database.update opt_allOrNone is not working on wrong Id

I'm trying to update a list of records and I need to update the records that pass the validation rules, and get the errors for not updated rows. I'm using this code that works fine for non Id ...
2
votes
1answer
31 views

Losing field level information

I'm having an issue where when I perform a dml operation on a sobject list, I lose field level information when catching the dml exception. Does anyone know a work around for this issue? Here is a ...
3
votes
1answer
1k views

Schema.getGlobalDescribe and “Invalid field LastReferencedDate for Account”

I am using this code to print out Account fields to PDF file . Programm fails when it tries to retrieve "LastReferencedDate" from the instance of account object. It fails with ...
2
votes
1answer
86 views

Send Email within Catch inside Constructor

It looks extremely easy, but apparently I can't make this to work. Not even tried: @future, not allowed in contructor create log error object, not allowed in consctructor I tried: inside the ...
1
vote
0answers
89 views

Time limit exceeded exception while updating Approval Process entry criteria

I am getting Time limit exceeded exception while updating Approval Process entry criteria. Is there any other way to change the entry criteria or workaround of this exception. Thanks in advance
2
votes
1answer
143 views

Is this problem from Salesforce side or eclipse side and how to solve it

Working with Schedulable class and make some changes in reference class which will be called when Schedule run.I have corrected all reference so there are no variable does not exist type issues but ...
3
votes
1answer
113 views

Detect if Compliance BCC Email is enabled

Problem: If the Compliance BCC Email setting is enabled email messages cannot be sent with custom BCC addresses e.g. Messaging.SingleEmailMessage toSend = new Messaging.SingleEmailMessage(); ...
1
vote
2answers
2k views

Exeception on After Insert, Record is read only

I'm writing a trigger for new opportunity products to populate a field Product_Category__c (on opportunity lineitem) getting the value from Product_Category_new__c (on Product). This is my trigger: ...
1
vote
1answer
60 views

Why doesn't SFDC think my unit test covering the Exception?

I am currently working on unit tests for the following method: @HttpGet global static REST_MemberRestServiceReturnClass doGet() { String[] uriKeysArray = ...
3
votes
1answer
159 views

Does a timebased workflow remain in queue after the criteria has become false?

I do have a time based workflow set on leads and when we try to convert them it throws an error RECORD_IN_USE_BY_WORKFLOW, Unable to convert lead that is in use by workflow: To overcome this i ...
4
votes
3answers
662 views

Email not sent from within catch or finally when exception is rethrown. Why?

As I am otherwise unable to debug a long running batch process in a customer org (logs are lost when I am not logged in all the time via subscriber support) of our managed ISV package, I tried to send ...
4
votes
2answers
942 views

System.LimitException: Too many code statements: 200001

Below is my code. companyList = [ Select a.Id,a.Name, a.Phone, a.Website, etc... From Account a Where a.RecordType.Name = 'Blah' ]; String csvString = ''; ...