Personal tools
You are here: Home Database Salesforce Apex & Visualforce

Apex & Visualforce

Apex/VisualForce Tips & Tricks
All those wires under the hood not making sense? Lick your fingers, grab two of them, and hope for the best...
Apex Language Reference
.pdf language reference manual for Apex. Provided by SalesForce.com
Apex Snippet: Task Copier
A class and method to handle copying tasks from one contact record to another. Takes a contact ID as a string (or ID, they're implicitly converted in SF), uses a contact named "Random Task" as a template for the tasks (this can be changed by reassigning the value for the global 'RandomTaskName') and returns the number of tasks copied from the template record to the calling record. It will not copy tasks from one to the other if the subject is already in the list of the calling contact's tasks.
Apex Snippet: Opp Task Copier
A class and method to handle copying tasks from one opoortunity record to another. Takes a opportunity ID as a string (or ID, they're implicitly converted in SF), uses an opportunity named "Task Template" as a template for the tasks (this can be changed by reassigning the value for the global 'OppTasksName') and returns the number of tasks copied from the template record to the calling record. It will also assign the tasks to the currently logged in user, set any closed tasks on the source opp to open on the destination opp, and move the dates forward. It will not copy tasks from one to the other if the subject is already in the list of the calling contact's tasks. Stolen from Kevin's Task Copier class.
Dealing with Apex Limits
Limits stink, but you can learn to deal
Apex for Smart People
A nice supplement to the official SF Apex documentation written by Idealist Consulting.
APEX Snippet: Products-2-Assets
This apex class takes opportunity owners (either accounts or contacts) and opportunity line items, and generates Assets for the contact/account based on the opportunity. Also required are a Ship_To_Account__c and Ship_To_Contact__c custom lookup field on the opp, and a Asset_Deployed__c boolean field on the OpportunityLineItem. This is usually triggered on Opportunity insert/update. Can be found in production in the League of Women Voters Education Fund instance.
Spontaneous Deactivation of Classes and Triggers
If your Apex classes and triggers are all showing as "inactive" in production, here's how to fix it.
Simple Visualforce List View Tab
You can create a custom tab in Salesforce that shows a subset of records in an enhanced list. No code needed!!
Spontaneous Invalidation of Classes and Triggers
My triggers and classes are active but invalid, what the heck does THAT mean?
Document Actions
« September 2010 »
September
MoTuWeThFrSaSu
12345
6789101112
13141516171819
20212223242526
27282930