• plarsen
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

Hi,

Im working with a dynamic where-statement in a query, and I want to be able to catch errors like when a user is entering a non-existing field name:

 

String Query1 = 'select count() from lead where ' + whereStatement;  

try{

Integer Master = Database.countQuery(Query1);

}catch(Exception ex){

ApexPages.addMessages(ex);

}

 

When I run this code e.g. with the whereStatement set to: Type__c = 'demo' (and the field Type__c doesn't exist on my Lead Object) I get an unhandled exception error and I can't seem to catch it in a nice way inside my code:

 

Apex script unhandled exception by user/organization: 00580000001gTj7/00D80000000ZWx3

Visualforce Page: /apex/MyVF_Count

System.Exception: No such column 'Type__c' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

On the other hand if the user enters a valid field but bad paramter, the exception is caught nicely (Type = "demo" ) in the try-catch block.

 

please help!

 

Hi

We are using custom list buttons on custom objects which executes javaScript

We have also removed/disabled the "new" button as all new records are introduced via the API

It all works fine unless you activate the Enhanced lists.

In the Enhanced list the button isn't triggered if it is the first (left most button).

If we move it and makes it button number 2 it works fine, but then the other leftmost button doesn't work.

 

The code is as simple as this:

alert("Running Start");

 

Anybody out there with a good explanation, and preferable with a fix.

Thanks
Peter
 
 
 
Is there any way to identify the acceptable picklist values when in Excel and trying to mass update records using the Excel Connector?
 
I guess I can create a dropdown list in Excel, but was wondering if there was a more integrated way?