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

learn more… | top users | synonyms

1
vote
1answer
26 views

Retreiving the value causing a DUPLICATE_VALUE DML Exception

I have an inventory management system I am working on and I have the need to let users input values to be created into inventory. These values consist of numbers that are used as the name for the ...
1
vote
1answer
37 views

System.LimitException occurs in WSDL Class

I'm getting System.LimitException: Too many callouts: 101 error message in my WSDL class file generated by SFDC. Repeated error was shown as following: ...
0
votes
1answer
38 views

Webservice 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. I am randomly getting "(IO Exception: Read timed out)" exception. When the ...
0
votes
1answer
15 views

Database DML throwing exceptions

According to SF if we use the Database class to issue a DML command: instead of exceptions, a result object array (or one result object if only one sObject was passed in) is returned containing ...
1
vote
1answer
24 views

Field Validation Exception and Database Class vs DML Statements

I'm trying to write a trigger and having some real trouble in making it work. Background: we adopted the Country/State picklist "Feature" last year. All the cleanup wasn't done. We have some records ...
1
vote
2answers
35 views

Which custom save() is better?

Sometimes in code examples of custom save methods (of controller extensions) you see the use of try/catch and an explicit translation of Exception to PageMessage. Explicit Error Handling: public ...
1
vote
2answers
32 views

System.ListException: Before Insert or Upsert list must not have two identically equal elements

I am trying to upsert some CustomObject__c record based on some criteria related to Opportunity Records. Set<Property2__c> properties = new Set<Property2__c>(); List<Property2__c> ...
0
votes
2answers
12 views

Ending position out of bounds

I have below trigger which passes string values to below class to do some changes for update. Please find the trigger. Trigger: trigger AccountFieldAutoUpdates on Account (before insert, before ...
3
votes
2answers
104 views

How to remedy “System.QueryException: expecting a colon” within Batch query

I have a Batchable class for scheduling a lead reassignment process. I recently made some edits to the query string and nod I am getting the error System.QueryException: expecting a colon, found ...
1
vote
1answer
17 views

Finish method in batch job not invoked after an exception is thrown and caught

I'm using Database.update in my batch class. This is wrapped around by a try/catch block. When I run the batch job some error occurs which is caught as I'm throwing a custom exception and catching it. ...
1
vote
0answers
11 views

QueryException for visible managed package field?

I've got a basic query that references fields in a managed package. The field is visible to all profiles, and the object has view all perms for all profiles. But throws this query exception No ...
4
votes
0answers
42 views

Exception during Inserting attachment from managed package

I'm working on managed package and I have to insert Attachment record from my apex code. The code is pretty simple, that's just create and insert Attachment, something like that: Attachment ...
0
votes
1answer
30 views

How to get Dynamic Variable value In Test Class

I have Two VF pages (SME Coach, SME info). SME Coach have a Picklist field. When I choose One Value here It will Dynamically Updated in Another picklist field (SME) In SME Info. Using the Value of ...
0
votes
2answers
28 views

Exception when Importing .csv file from CLI

I am able to import my .csv file using Apex Data Loader. When I try importing the same file from CLI I am getting an exception attached in the file. When the file contents are copied into a new csv ...
1
vote
0answers
42 views

Email Service does not receive Apex Exception Mails in DE Org

In an Managed Package, we want to produce an Custom Object for each Apex Exception Mail that we receive. In order to implement that we followed the instructions we found here. We created an Email ...
2
votes
3answers
60 views

sObject type 'Partner' is not supported

I have a Update trigger on Opportunity. The trigger queries the Partner object. [Select AccountToID from Partner where OpportunityID IN: Trigger.newmap.keyset()] The above trigger has been running ...
0
votes
0answers
37 views

DMLException error not coming properly

I am trying to upsert a record and and I am expecting, when I hit the button, then it will check for Invalid Email address, and if there is any then it will show me the error in the pageMessage. ...
1
vote
4answers
134 views

How to create records with inactive user as the owner. A Salesforce Spring 15 feature

Salesforce Spring 15 release notes says 'Create or Edit Records Owned by Inactive Users'. But I am unable to assign any inactive user as the owner of the record in Spring 15 Org. I get the ...
0
votes
2answers
46 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
51 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
27 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
38 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
162 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
89 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
251 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
43 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
33 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
114 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
64 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
88 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
60 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
429 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
62 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
74 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
107 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
85 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
1k 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
57 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
232 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
69 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
120 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
265 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
1k 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 ...
7
votes
1answer
118 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
460 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
75 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
279 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
142 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
247 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 ...