Quick Apex Tutorial in 4 Easy Steps

Apex is the programming language of Salesforce. If you are interested in one of the most lucrative programming careers in the coding world, THIS should be your next stop.

To start, you should know a thing or two about Salesforce. You should also create a FREE Developer Org here.

Salesforce Basics

Salesforce is cloud-based CRM (Customer Relationship Management) software. It keeps track of managing all the common types of information you would expect:

  • Customers/businesses (called Accounts)
  • The various people associated with those businesses (called Contacts)
  • Prospective Customers (called Leads)
  • A sale or pending sale (called Opportunities)

These are just a few common ones. There are many, many more.

Each of these above are called “Objects” in Salesforce. The “Account” object will have many “Fields” associated with the Account. These fields store information like Account Name, Address, City, State, Zip, Phone, Email, etc.

Salesforce comes with many of these standard fields out of the box, but also allows you to add custom fields to capture data about your customers that are specific to your business.

Apex Basics

Salesforce gives you the ability to create automated process through the use of Apex Triggers. This gives developers the power to be able to customize the very powerful Salesforce engine and do things that an “out of the box” version of Salesforce is not able to do.

The ability to customize Salesforce is VERY important to businesses, because businesses are not all the same. Businesses want their businesses to be able to do things specific to their industry.

When you are able to create an automated process to do a repeatable task, it saves the time that you would normally have a human doing it and thus saves that business a lot of money. Business owners ears perk up when they hear they can save money.

Let’s create our first Apex Trigger.

Step 1: Log Into Your Developer Org and Click the Gear Icon

Step 2: Click the “Developer Console” Link.

The developer console is like a coding editor. It is where you can write your Apex Triggers, Apex Classes and much more.

Step 3: Click File > New > Apex Trigger

Step 4: Give it the Name “MyFirstTrigger” and select the sObject “Account” and click “Submit”

In this step we are naming your trigger and telling it what Salesforce Object (sObject) that the trigger will be running against. A trigger always has to specify the object it will be using. Here we will use the Account object, but as you can see you can select any standard Salesforce Object or any Custom Object.

You now have created your first Apex Trigger. Now the trigger doesn’t do anything yet. You’ve just created the frame work for your trigger. The next step would be to tell it what to do and when to do it.

But we’ll leave that for another day. Great job!

What type of automations do you think would be most helpful for businesses? What potentials do you see with having this type of capability?


50% Complete

Get our latest tutorials, tips and tools to help you learn to be an Apex Programmer!

Every week I'll update you on the latest from Apex Coding Academy and you'll get first access to new resources, offers and events.