jkraybill
  • Member for 9 years, 6 months
  • Last seen more than a month ago
Apex List For Loops 101
Accepted answer
56 votes

No. They are not the same thing. There are differences in the way they work. In your example, they accomplish the same thing - you do indeed get a reference in each case to the element you want, and ...

View answer
How do I query queue ID in Apex?
Accepted answer
46 votes

Queues are stored as a Group SObject, so select Id from Group where Name = 'My Group' and Type = 'Queue'

View answer
can salesforce handle 50 or 70 million records?
37 votes

Can a Salesforce instance contain 50+ million records? Almost certainly. I've seen instances with millions of records, although none as large as 50 million. A Salesforce sales person would be able to ...

View answer
What is a good set of coding conventions for Salesforce development?
32 votes

Great question. I haven't seen a good full set that's publicly available. For clients in my consulting days, I've written maybe a dozen or so sets of SFDC coding conventions but sadly can't share ...

View answer
IE10 Forced into IE7 Standards document mode for Visualforce
Accepted answer
24 votes

I can't recall if it solved the exact issue you are describing, but I had an IE version compatibility issue (I think affecting IE9) which was definitely solved by adding Apexpages.currentPage()....

View answer
What is the best way to deploy profiles in Salesforce? (especially system admin)
24 votes

Profiles are the only piece of metadata for which I advocate making changes by hand. It can be tons of clicking, but the metadata API is far too "all or nothing" for profile changes to easily keep ...

View answer
When should a static intializer be used?
23 votes

In theory, you use static initializers for the scenario that Jesse described - as the de facto constructor logic in a static method utility class. In practice, I almost never use them in Apex, ...

View answer
apex method for logout from force.com site
Accepted answer
16 votes

You are correct, there is no Site.logout() method, sadly. Directing to the /secur/logout.jsp page is the only Salesforce-blessed method I know of for doing logout, and doesn't support any conditional ...

View answer
PGP Encryption in Apex
Accepted answer
15 votes

I've never seen one, and I think you will probably have a tough time implementing PGP support natively in Apex. The Crypto API only supports symmetric encryption using AES, and unless I'm forgetting ...

View answer
How to study/prepare for the Salesforce ADVANCED Developer Certification?
14 votes

I doubt this will be a popular answer, but if your year+ of experience has involved plenty of coding across the various technical areas of the platform, you shouldn't need to study. The passing ...

View answer
Using a date for a datetime field in a SOQL Query criteria
13 votes

You'll want to check out the Date Literals that were added a few releases ago. They start at midnight of each range, and have things like LAST_N_DAYS, LAST_QUARTER, etc. The only gotcha is it takes a ...

View answer
Salesforce Long Text Area fields in formulas
Accepted answer
13 votes

No, there is not. There is an Idea to support it here. In the comments for that Idea, there is a workaround described (and also linked to and described here) that uses workflow, but that isn't ...

View answer
What is a concise function that formats a (String) decimal into a currency format in Apex?
12 votes

@RickMeasham's method is a good one, but I ran into a couple rounding issues with negative values and fractional values. Here's my edited version of the method that passes the tests I needed it to (...

View answer
Catching Limit Exception: "Attempted to schedule too many concurrent batch jobs"
Accepted answer
11 votes

You can't catch LimitException. They are a special class of fatal error that simply cause your code to blow up the minute you hit one. So your only strategy is going to be avoidance. Counting ...

View answer
Static vs Singleton
Accepted answer
11 votes

Singletons not only are not needed in Apex, they are basically pointless. In that previous thread, I described why stateful singletons are pointless, but stateless singletons are pretty much in the ...

View answer
Finding if a custom field is editable using Apex code
10 votes

Available through the Describe API. You are looking for Schema.DescribeFieldResult.isUpdateable().

View answer
Is it possible to create a reusable inline Visualforce page?
Accepted answer
10 votes

You don't have to create a separate apex controller for each VF page, but you do need 1 VF page per standard controller you need to "extend". What I generally do is create a single controller class ...

View answer
Best practice for calling Apex methods from custom button?
Accepted answer
9 votes

There isn't really any problem with what you're doing. While you could set something up via Apex REST to support direct execution of methods without having an empty page, an empty page isn't a problem....

View answer
Traversing lookup fields to related record fields
Accepted answer
9 votes

Relationships need to be navigated with the "r" extension, e.g. r.Billing_Contact__r.Address__c The "c" is the field itself, which is just an ID (hence the error about String); the "r" is the ...

View answer
Why am I always logging in with Guest user profile on sites even though I enter partner credentials?
Accepted answer
9 votes

Anonymous (unauthenticated) users always show as "logged in" as the Guest User; authenticated website users always show as the actual authenticated user. If you are only seeing activity from the Guest ...

View answer
Getting namespace prefix of an org
Accepted answer
9 votes

Query for it, using a class that you know will be there: ApexClass myClass = [ select NamespacePrefix from ApexClass where Name = 'SomeClassNameHere' ];

View answer
Force.com IDE - any news on the "after the refactor version"?
Accepted answer
8 votes

Disclaimer: this is a very unofficial answer, safe harbor, blah blah. However, I have word from an unofficial source that the promised Eclipse IDE refactoring (Tooling API, general re-factor) has ...

View answer
Typecasting for VisualForce?
Accepted answer
8 votes

Per my comment, you don't want typed dot-accessors, you want untyped map accessors (https://www.salesforce.com/us/developer/docs/pages/Content/pages_dynamic_vf.htm). i.e.: {!program['program']['name']...

View answer
No master-detail relationship in which the User or Lead objects are the master?
Accepted answer
8 votes

Well as John Gaughan says, the basic reason is "because Salesforce says so" or perhaps I would phrase as "it's a platform limitation." Architecturally, it is because there are limitations in the ...

View answer
What happens if our App provider goes away?
8 votes

If this is a legitimate concern for you, then your best bet is to negotiate an escrow agreement for the source code. It's not unusual in enterprise software to enter into an agreement with a software ...

View answer
LMO without using partner portal
8 votes

You can't use LMA/LMO without being part of the Salesforce Partner Program. Be aware that the Salesforce Partner Portal (the one for ISV/consulting partners of Salesforce) is not the same thing as ...

View answer
How can we disable triggers, Validation Rules and workflow rules in salesforce org. [on off - switch]
8 votes

The best way I've seen to handle this is, indeed, to pre-build your validation rules and other logic with some in-built switch. Custom labels are probably the best suited to this if you want to ...

View answer
Going beyond the marketing material, what are the real differences between the Salesforce versions that affect the way a business uses Salesforce?
Accepted answer
8 votes

My sincere advice to companies who say they can't afford enterprise addition is: if you can't afford or justify the price of EE, don't use Salesforce. GE is pretty close to useless, especially for ...

View answer
Scheduled batch "already scheduled"
7 votes

I have seen similar behavior before. I've also run into two related issues when running self-scheduling jobs that run a lot: the "scheduled job" list gets really long even though most jobs in the ...

View answer
Merging two triggers into one
7 votes

This is perhaps not the simple "no" you were looking for, but here's the pattern I generally recommend for triggers, which I think will help you in this situation. First, put your actual trigger ...

View answer
1
2 3 4 5
7