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

learn more… | top users | synonyms

4
votes
2answers
49 views

Does one use savepoints in triggers?

It's not clear to me. Suppose I write an after update trigger on opportunity to update some related accounts and then contacts. Now I lets suppose that I had luck with the accounts but the second ...
1
vote
1answer
48 views

Ending position out of bound exception

I have below trigger that is getting below. I want just the letter after '-' to be in uppercase. Compile Error: execution of BeforeUpdate caused by: System.StringException: Ending position out ...
1
vote
1answer
20 views

Detecting and retrying CalloutException in Batchable iterable

I have a nightly batchable job in my SFDC org that queries a remote SFDC org for account and opportunities meeting certain criteria. Works great but every so often, I get System.calloutException read ...
1
vote
1answer
23 views

Catching exception and posting it back on the page

I am trying to catch an exception and have it send an email as well as post message back on the case record, when user hit save, so the user will see it as well. what I am get is this ...
2
votes
0answers
27 views

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

I am facing this issue in a MockCallOut for http in test class. I know that a dml is not allowed just above the callout, so I have tried to put callout between Test.startTest() and Test.StopTest(); I ...
3
votes
1answer
31 views

Handle exception in managed package

What are the different approaches to handle exceptions inside a managed package? Just a brief heads up would be really helpful. From my research, I understand that it is not possible to get the ...
0
votes
1answer
32 views

SOAP callout error: Failed to deserialize value

I am testing an integration between Salesforce and another system via Web Service Collouts. For that, I am using WSDL->APEX generated class. When invoke the web service via anonymous apex, I get a ...
-1
votes
0answers
29 views

I am getting Attempt to de-reference a null object

Date d=date.today()-365; now I'm getting Attempt to de-reference a null object exception.please can anyone help.
0
votes
2answers
37 views

List Index Out of bound exception

Please find my below code that is getting list index out of bound exception. Apex Class: global class Incidentimp_2 implements Database.Batchable < sObject > { public string query = ...
19
votes
9answers
367 views

How can I cause side effects outside a transaction context?

I've got a scenario that relies on the system's "automatic rollback" behaviour to undo any DML, emails, futures and so on, in the case of an error. Basically, by allowing code to throw an unhandled ...
-1
votes
2answers
35 views

How to resolve the apex Governor limit exceptions?

i am newly move into salesforce. am facing some exception problems. For example: In my Controller, lot of insertion and updation of data. whatever the Trigger i have inside my all, they are getting ...
0
votes
1answer
56 views

How can I communicate a trigger exception to user in a bulk upsert for each record?

I am performing a bulk upsert with a large batch (sometimes as much as 3000 records at one time). I am splitting the list of 3000 into 5 batches and performing an upsert using the Bulk API. When I ...
0
votes
1answer
57 views

Getting "System.DmlException: Process failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

below is method which i have created in my class, public static void rejectCRF(String recordId, String workItemId, String comments) { Approval.ProcessWorkitemRequest req2 = new ...
0
votes
0answers
38 views

Design Approach: Apex Callout limits

I am developing an appexchange managed application intended for multiple subscribing organizations and as a part of requirement my managed application needs to make an extensive API callout to an ...
1
vote
3answers
529 views

System.LimitException: Apex CPU time limit exceeded

I got this exception while running following script in developer console.I need to update account records by using this script. YearExt yr = new YearExt(); List<Id> accountIds = new ...
0
votes
1answer
47 views

How to manually give a callout in test class

I needed to throw a callout exception by hardcoding it in test class for batch class.Is there any method to do that ? try{ XXXX } catch (CalloutException excpObj) { ...
2
votes
1answer
99 views

Why record is removed on exception thrown

I'm inserting and updating a new record before throw an exception like this: Operation__c o = new Operation__c(ok__c = false,Step__c = 'test1'); insert o; system.debug(o); //this shows the Id try{ ...
1
vote
1answer
162 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
45 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
64 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
146 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
746 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 ...
6
votes
0answers
97 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. ...
3
votes
1answer
318 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
48 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 ...
3
votes
1answer
152 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
103 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
199 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
57 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
49 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
107 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
79 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
133 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
160 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
283 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
128 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: ...
4
votes
3answers
351 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
114 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 ...
3
votes
2answers
2k 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> ...
2
votes
3answers
438 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
2k 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
124 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
545 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
40 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
113 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
436 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
103 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
166 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
52 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
135 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 ...