Salesforce Apex Development Best Practices and Strategies


Determining Org Type in Apex Code

Have you ever wanted to run one block of code in a sandbox and another block in the production org?  I couldn't find a built-in Apex function that allowed me to determine whether the code was running in a Production/DE environment or in a sandbox. Fortunately, I ran across this post that gave enough info to write the following simple…
Artie Brosius
October 12, 2012

On-View triggers in Salesforce (trigger for Opportunity Contact Roles)

Native Opportunity Limitations One current limitation with Salesforce.com native Opportunities model is the inability to have a trigger on the Opportunity Contact Role object. Say you have built a custom Opportunity rollup or scoring mechanism of some variety and it relies upon what/who the user selects in the Opportunity Contact Role area: how will you detect a live change in…
Tom Burre
August 30, 2012

Setting Lead Assignment Rules with Apex

If you want to create a new Lead via Visualforce or web form with Apex it's very possible you could overlook the Assignment Rules.  As you might know, it's not even always obvious on the native Lead creation layout.  Notice the lower left corner checkbox in the screenshot below. To enforce Assignment Rules in Apex you'll need to instantiate the…
Tom Burre
November 19, 2009