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

learn more… | top users | synonyms

1
vote
1answer
15 views

Tooling API error: Object type not accessible (JSforce)

I have this very simple script on the JSforce script executor: var apexBody = "<apex:page standardController='Car__c'>Test</apex:page>"; conn.tooling.sobject('ApexPage').create({ ...
1
vote
1answer
15 views

List more than one row error

I have below controller where SaveOutcome method throws error : "System.QueryException: List has more than 1 row for assignment to SObject" Can someone please let me know the root cause. ...
4
votes
2answers
23 views

Failing test is showing as passed

In Debug Logs I can see a System.NullPointerException for the unit test that was just run, but on the Apex Test Execution page I see the test as passing. The error is not buried within the log ...
2
votes
1answer
35 views

Custom Exception Handling & Logging

I've set out to build a custom error handling and logging feature for my org wherein all apex exceptions will be logged into a custom sObject for analysis and follow-up. public class TriggerException ...
0
votes
0answers
9 views

Service invokation error handling logging [duplicate]

I am calling many external SOAP based web services from controller. Is there a best practice framework / pattern / app using which i can achieve exception handling and logging while calling external ...
0
votes
1answer
18 views

Calling JSON.deserialize() throws “System.NullPointerException: Attempt to de-reference a null object”

I'm trying to use the System method JSON.deserialize(jsonString, apexType) to deserialize the body of an ApexRest POST request. My code compiles, but at runtime I'm getting a ...
0
votes
0answers
28 views

Upsert throws Missing Argument exception. Any thoughts please?

I tried to upsert and my code is below. But i am getting an exception and nothing is inserted or updated. Any thoughts please. if(lstp.size()>0) { Boolean isUpsertfirstTime = true; try { ...
2
votes
2answers
47 views

SObject Exception: Invalid field for Opportunity

I am attempting to set a flag on the Opportunity Header based on an Aggregate Query of the Opportunity Line Item object, and I keep getting an SObject Exception. My code and the error log are below, ...
0
votes
1answer
22 views

JSON single quote exception while testing REST service using Postman client. Any suggestions?

While testing a REST service i am getting a JSON parsing exception as given below. [ { "errorCode": "APEX_ERROR", "message": "System.JSONException: Unrecognized character escape ...
2
votes
0answers
28 views

SOAP API extend idle time

I am running the following query SELECT Id, ParentId, Name, ContentType, BodyLength, Body, OwnerId, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp FROM Attachment ...
2
votes
4answers
111 views

How to insert a record and then do callout? [duplicate]

I have a visualforce page where i get a serial number and making callout to get the related information from external system on click of a button. Before making the callout i need to insert a record ...
2
votes
1answer
53 views

How to catch custom exception in a test that causes a DML exception

I am writing a test for a 'before insert' trigger. In the trigger, an exception is thrown if there is a problem with the validation (by design). In production, the trigger catches the exception and ...
1
vote
1answer
53 views

Developer script exception -System.SObjectException: Invalid field MyField__C for OBJECTNAME

I have written following code in one of my Trigger - List<Setting__c> settings = new List<Setting__c>(); settings = [select name,field_api__c,Type__c from Setting__c where Object_Label__c ...
3
votes
1answer
26 views

Testing, getting a null reference in a list when it is not null?

Ok, I am confused as to why I am not getting a list returned back to me. The error I am getting is: System.ListException: List index out of bounds: 0 However, I know that means that there is ...
1
vote
1answer
16 views

reassigning account executives - apex class

I am trying to reassign Account executives depending on the requested date of open cancellation opportunities. If the requested date is 90 days later than today, I want the open cancellation ...
2
votes
1answer
35 views

System.unexpected exception when I run Reports.ReportManager.runReport(Id,true) within for loop

I am facing System.unexpected exception when I excecute below code. List<Report> repList=[SELECT Id, name,DeveloperName, Format FROM Report WHERE ...
4
votes
1answer
65 views

Can you make trigger exceptions pretty in standard page layouts?

We have a situation where it is possible for a trigger to throw an exception that will be shown to the end user. This isn't ideal as the user sees a lengthy message containing what is essentially a ...
0
votes
2answers
84 views

I get System.LimitException: Too many query rows: 50001 when querying via a static method in a different class but not if querying from the same class

I understand this exception. But what I don't understand is this: THIS APPROACH WORKS: public List<String> optionType { get { if (optionType == null) { ...
1
vote
2answers
28 views

How to access this transaction's debug log from a trigger?

"Developer script exception" emails that are sent to developers for unhandled exceptions sometimes include full debug log. How can I access this debug log from a trigger so that I can email it to ...
3
votes
0answers
77 views

ValidationRule queried via REST API returns Deleted objects VR too and that results in error with GACK?

When I try to query ValidationRule via REST (Tooling) API it's returning weird error: Query used: ...
1
vote
3answers
80 views

Invalid Foreign Key Relationship when referring to custom object text field

Hopefully this is a simple one, but I'm pretty stumped. Basically, I'm editing a text field of a custom object. However, it seems I get a Invalid Foreign Key Relationship error when I try and check ...
1
vote
1answer
87 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
73 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: ...
2
votes
1answer
440 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
38 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
74 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
39 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
87 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
92 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
287 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
57 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
16 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
51 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
169 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
40 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
1answer
77 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
265 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
51 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
341 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
110 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
86 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
34 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
46 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
742 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
119 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
542 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 ...
2
votes
1answer
78 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
51 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
205 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
85 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 ...