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

learn more… | top users | synonyms

1
vote
1answer
29 views

Database.executeBatch cannot be called from a batch start, batch execute, or future method

I have an after insert,after update trigger on object A which calls Database.executeBatch for insert and update operation which inserts and updates object A records.I have anotherafter insert trigger ...
3
votes
1answer
21 views

Is there a way to catch the “Search Unavailable” exception that is thrown when doing a SOSL query?

We have a try/catch block around the line doing the query, but we still get this exception mailed to us on some SOSL queries: List<List<SObject>> ret, queryResult; try { ...
1
vote
1answer
29 views

Validation fails, but no exception generated

I have a VF page for input of a custom object. As part of the object, I have validation rules. My problem is that a failing validation fails to generate an exception. It also fails to create the row ...
4
votes
2answers
74 views

Governor limit SOQL 101 being suppressed. How?

As far as I know, Governor limits can not be suppressed and will be shown to user on the UI. However I am facing below scenario where SOQL 101 limit is being logged into debug log and not being shown ...
1
vote
1answer
89 views

System.NullPointerException: Argument cannot be null

Im getting the error 'System.NullPointerException: Argument cannot be null' when I run my test class, in the below test method. /* * update a existing report */ static testMethod void ...
4
votes
0answers
63 views

Creating Idea Votes from portal user in Test code. DML Exception

I Wrote a very simple VF Page and Controller to show the Accounts that voted on certain Ideas. Here is the controller. Just aggregates the Up and Down votes on the Idea excluding internal votes. ...
2
votes
1answer
125 views

System.DmlException: Delete failed.SELF_REFERENCE_FROM_TRIGGER

Hi All I have written the apex trigger.It working in sandbox but not in Production.While upload the csv file by using apex data loader in production it throws an exception below. Exception: ...
2
votes
1answer
26 views

Check APEX exception type

I'm looking to check what type of exception is retruned in the following code snippet. I'm not sure exactly how to do it though, or if it's even possible. try { //SOME LOGIC } catch (exception ...
2
votes
1answer
75 views

Unable to Delete the records/rows in Trigger

I have trigger it working in Sandbox.It delete the records when the field "Delete__c" check box is checked.I have tested 200 rows,Trigger deleted rows in sandbox but the same scenario in production ...
1
vote
1answer
59 views

renderAs CSV (10K+ rows): What are the best practices available to avoid hitting Apex cpu time limit exceeded limits?

I am trying to download a CSV using render as attribute in apex:page. The output data that is rendered is the real-time response from a callout from salesforce to SAP webservice. The number of records ...
5
votes
1answer
164 views

How to capture those records that was unable to get inserted?

Say, I have a list of 1000 records to be inserted. How to capture those records that failed to get inserted? I realize that I can use DMLException to get the error. But how to get a list of failed ...
0
votes
0answers
48 views

Unknown Exception. Too many Query rows

I have 3 SOQL Queries running in an Apex class. I'm using the related VF page in Force.com sites. When this code runs, it is throwing an exception on the page. No exception is caught in debug logs. ...
0
votes
2answers
35 views

How to handle the exceptions occured in expressions used in visualforce page?

I am having an expression to divide a number and get the percentage and display it in vf page. The following expression in visualforce page working fine previously is now complaining and ended with an ...
1
vote
2answers
54 views

Apex DML bulk insert - how to display only list elements that fail DML

I have a try catch block to handle any problems when inserting a list of users, however, if an exception is encountered, how can I output which user in the list this exception is occurring for? I'm ...
6
votes
1answer
59 views

System.UnexpectedException: Read of id returned an invalid id '000000000000000'

Since a few days ago a some methods in one test class started to fail with this exception System.UnexpectedException: Read of id returned an invalid id '000000000000000' What is more ...
1
vote
1answer
64 views

System.AsyncException: No enclosing class for method: methodName

I have this error that says "System.AsyncException: No enclosing class for method: methodName". The code structure : trigger trgSendRecords on DataSetup__c (after insert) { /* SOME BUSINESS ...
2
votes
0answers
64 views

System.CalloutException: Received fatal alert: bad_record_mac in calling External URL

I am having the below error for calling out the external web URL which is supposed to be accessed by public at all time. System.CalloutException: Received fatal alert: bad_record_mac I found that ...
2
votes
1answer
166 views

Third party API has callout time limits: how to catch with error handling, and how to control callout timing?

The third party API I'm working with (Act-On, a marketing software), has a limit of 5 callouts per minute in their sandbox. Unfortunately for me, some of my code requires that I loop through a series ...
2
votes
1answer
86 views

How can I dynamically transverse dynamically SOQL'd SObject fields in Apex?

So, in my other post, I figured out for myself how to dynamically transverse SObject fields in Apex. But within the context of my work, there is a problem with the solution as it currently stands: ...
3
votes
3answers
141 views

Trigger : Need Help for showing a nicer error

I have created a trigger for the following behavior in my Salesforce org: When the user changes the Account Owner, it automatically changes the Contract Owner on the related contracts before update. ...
1
vote
2answers
63 views

Custom Exceptions — How does SFDC get it done in the back end?

Suppose I have the following Class: public class Yup{ public class YupException extends Exception{}//END YupException public static void debugTestException(){ YupException ...
2
votes
2answers
975 views

System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

Im getting CalloutException.You have uncommitted work pending. Here's my VF Page. <apex:commandbutton> SAVE </apex:commandbutton> <apex:pageBLock> <apex:column> ...
0
votes
3answers
183 views

System.TypeException: Invalid date:05/05/2013

i just executed these lines in anonymous block and got this exception. Any suggestions? Date dt; dt = Date.valueOf('05/05/2013'); System.debug(dt); System.TypeException: Invalid date: 05/05/2013 ...
1
vote
2answers
795 views

Salesforce Certificate Exception: No subject alternative DNS name matching found

We are trying to make a callout to "https://support.breadwinnerhq.com/bwpayment/v1/accounts/somevalue" from Salesforce. But, we are facing an exception: System.CalloutException: ...
4
votes
1answer
77 views

How can I dynamically transverse SObject fields in Apex?

I am trying to dynamically create a CSV file from Case records. The fields for the CSV file will be determined in custom settings (and therefore shouldn't be hardcoded). Moreover, the fields may ...
2
votes
1answer
248 views

Code execution does not stop even after an excepton thrown. Any suggestions?

i am having an issue where my code does not stop executing even after an exception has thrown. In the following code, i want to display an error message on the page when the user did not enter an ...
0
votes
1answer
33 views

Is that possible to continue the execution even after an exception thrown?

I have a list of 1132 records and the record at 646 breaks and threw an exception when it tries to convert a invalid string to double. And the code halts and my pageblocktable displays 645 records. Is ...
2
votes
0answers
69 views

Strange TypeException errors in Account triggers

I have a very basic trigger that once particular object is updated serializes it to JSON (all fields) and posts to external web service. (This trigger is installed on the organization via managed ...
4
votes
3answers
289 views

Exception class must extend another Exception class. Why?

I got the following error when i try to create a test class which it seems to be legitimate. But it complains error. I do not know what is issue in this class. Save error: testCustomException: ...
1
vote
1answer
88 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
109 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
42 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
93 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
85 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
199 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 ...
2
votes
2answers
556 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
67 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 ...
5
votes
0answers
72 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 ...
4
votes
2answers
473 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
37 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
866 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
891 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
57 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 ...
2
votes
1answer
102 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) ...
5
votes
1answer
37 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 ...
2
votes
2answers
196 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
1k 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
81 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
37 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
211 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 ...