Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- Embedded variables in Query
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Embedded variables in Query
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-30-2012 09:42 AM
This method gets an Account object using an object_id, but it is throwing an exception. I know the object_id exists, because I get it from an Account object stored in the database (the code is used in an @future method, so I can't use the object).
Why would this be failing? Is it syntax in the SELECT statement?
protected override object getObjectById(Id object_id) {
List<Account> account_scope = [SELECT Id FROM Account Where Id = :object_id];
return account_scope.size() == 0 ? null : account_scope.get(0);
}
Solved! Go to Solution.
Re: Embedded variables in Query
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-30-2012 10:07 AM
As you are using static apex, the syntax is validated at compile time.
When you say fail, what do you see? Is it a return value of null?
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.
Re: Embedded variables in Query
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-01-2012 12:37 PM
Hi Bob,
Sorry to be late getting back to you. I was getting an exception, but I think that I was tracing it to the wrong place in the code. This is now working.
I'm relatively new at Salesforce and finding the debugging tools a little lacking. The primary method I've used is to log messages, run it in the Developer Console, and check the log file for results. Is there other methods I could be using?
Re: Embedded variables in Query
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-02-2012 01:19 AM
In the developer console you can also produce heap dumps at regular points. See:
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.

