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

learn more… | top users | synonyms

0
votes
2answers
31 views

Null Pointer exception

I have below generic class, whose methods are called from an Account before insert , before update trigger. Below class is getting a Null Pointer exception for any Account at commented line. Can ...
0
votes
1answer
33 views

What type of Exception is thrown for using inactive Users?

I've got a Before Update trigger that attempts to assign a new Owner on Accounts and I'm trying to handle the potential exception where the new Owner is inactive. I can cause the error in testing (An ...
0
votes
1answer
21 views

When exactly would a Calloutexception occurs in Salesforce?

I am trying to send a XML from Salesforce to an external system and callout exception occurs time and again . It is occurring sometime but working fine most of the times . What are the cases when a ...
0
votes
1answer
30 views

List out of bound in below code

I am getting list out of bound error here in below code. Can someone please help me? Apex class snippet: for(Incident_abv__c inc : [select Name,Id from Incident_abv__c where ...
1
vote
2answers
37 views

INVALID_CROSS_REFERENCE_KEY Exception

I keep getting this error when running a Test Class and I just don't know where to go from here. I've tried disabling Parrallel Apex Testing, running the code as a standard user, etc. I must be ...
4
votes
2answers
66 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
88 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
25 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
25 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
50 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
34 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
50 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 ...
0
votes
2answers
44 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
388 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
47 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
65 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
75 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
52 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
752 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
50 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
191 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
49 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
86 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
190 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
971 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
103 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
367 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
57 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
190 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 ...
2
votes
1answer
117 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
212 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
61 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
62 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
133 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
83 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
160 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
173 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
306 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
135 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
427 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
141 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
517 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
3k 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
138 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
623 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
43 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
117 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
492 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: ...