Sara Has No Limits

Good Programmers Evaluate, Simplify, Automate and Document

Apex Code

Avoid Recursive Triggers with Static Variables

badrecursivetrigger

A lot of different things happen when a trigger is executed, which can cause trigger code to be executed more than once per transaction. For example, before and after triggers are executed twice if fields are updated based on workflow rules. Additionally, your trigger code may modify records, which can cause the trigger to fire again. For example, if the following code is executed it can potentially cause a CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY […]

Continue Reading →

More about Unit Testing

TestLoadData

Even though you can create a valid unit test just using the testMethod keyword, Salesforce recommends that you also use the @isTest annotation at the class level and encapsulate multiple unit tests in a test class. By doing this, all your unit test code will not count against the 3MB code limit, which limits the total amount of code your org can produce. Additionally, all your code will be compliant […]

Continue Reading →

Force.com IDE and Version Control

Development with the Force.com Platform Your development environment should consist of the following two tools: At least one dedicated Sandbox – Allows you to use the Setup menu to customize applications, modify metadata and synchronize changes Force.com IDE – Used to develop code, customize and create metadata in Bulk, deploy metadata, support version control and synchronize file changes Eclipse Eclipse is an extendable integrated development environment that supports a variety […]

Continue Reading →

Manage Sandbox Environments

SandboxComparisonChart

Sandboxes Sandboxes are a clone of an entire production environment that allows developers to develop and test without risking production data. There are three types: Full – copies the entire prod org (although you can choose to omit some data and have it load faster) Configuration-only – copies only the configurations and does not copy any data. But, you can load up to 500MB of data Developer – Similar to […]

Continue Reading →

Apex Class Notes – Advanced Topics

describecode

Dynamic Apex Components Enables you to create more flexible applications by providing you the ability to access sObject and field metadata descriptions Allows you to write dynamic SOQL and SOSL queries and dynamic DML Consists of several components: Schema Describe – way to programmatically discover info about the current org schema. You can use the following to get a map of the schema: Map<String,Schema.sObjectType> gd = Schema.getGlobalDescribe(); Dynamic SOQL – […]

Continue Reading →

Deploying Apex Code

Deployment Process – Steps are as follows: 1.)    Develop Develop Unit Test Begin Integration Testing 2.)    Integrate Software modules are tested as a group Integration testing may be done in another sandbox and is done before functional and acceptance testing 3.)    Stage Full regression testing Load Testing Specific new feature testing User acceptance testing 4.)    Production/Training After changes are accepted, change control board approves deployment in production and/or training Prerequisites […]

Continue Reading →

Follow

Get every new post delivered to your Inbox.

Join 81 other followers