1.1 An important message

Open Developer Console

There are several ways to write code in Salesforce. For now, let’s use developer console. It is a very good tool for beginners. There are several reasons:

  1. It is Salesforce built-in tool so there is no need for installation or configuration.
  2. It has good syntax highlighting. And it also helps you with code indent.
  3. If you have any errors in your code, it will tell you right away.

So, let’s start using it.

Open Developer Console via Your Name > Developer Console, as shown.


Write our first code

In the opening Developer Console, click ctrl + e. If you are using Mac, click cmd + e. This should open your Execute Anonymous Window. You can consider this as your playground for now. It should look like this:


Type in the below code:

System.debug('I am determined to start learning Salesforce development today');
System.debug('Today is ' + Date.today());

Then click Execute. Find the log in your logs tab. Double click to open it. In the filtering input, type in ‘DEBUG’. Make sure it is capitalised as the filter is case sensitive.  The result should look something like below:


In the future, when I say look at the debug logs, it means open the debug log and filter it with ‘DEBUG’. I will not explain the details in the future.

A little explanation: 

The code should be pretty straight-forward. But I will explain a little in details.

System.debug(), here System is the namespace. But you don’t need to worry about it for now. Just consider System.debug() means type the information out in the debug log.

Date.today() means today’s date. You don’t need to worry about the grammar for now.

Every statement in Apex need to end with ; This is the same as many other programming languages like Java and C#. In Apex, break lines doesn’t mean much unless it is in a quoted string. Only ; means it is an end to the current statement.


Write a piece of code to display ‘Hello, my name is Lance. This is my first day of learning Apex.’ Please replace Lance with your own name here. You should be able to see the result in your debug log.

Next Post:

1.2 An introduction to Developer Console

Subscribe to Sfdcinpractice

Subscribe to get the latest blogs and tutorials of sfdcinpractice. No spam, no trash, only the awesome posts from sfdcinpractice. 



  1. Axel Santos - February 15, 2018 @ 3:39 pm

    The tutorial is great, but I think it needs an update, we are using Spring 18 now. Thank you for your hard work

    • LanceShi - February 18, 2018 @ 11:39 pm

      Thank you, Axel. I am working with Salesforce on a daily basis on I am aware of the recent changes. However, for me, those apex code, triggers and others mentioned in this tutorial isn’t changed that much. The only thing I can think of is lightning experience vs Salesforce classic. As many of us are still using Salesforce classic, I don’t think it is a big issue describing the UI in classic for now. And if you are using lightning experience, it is still easy to find the developer console and then everything else will still be the same thing.

Leave a Reply

Your email address will not be published / Required fields are marked *