Join Duard Lynn Davis for an in-depth discussion in this video Environment setup, part of Learning Salesforce.com Development.
- [Instructor] Okay, the first thing we're going to do is set up our development environment. And Salesforce does have a browser development environment where you can do your code there. What I like to do, personally, is I like to download a force.com IDE plugin that I install into Eclipse. One of the reasons I use Eclipse, there are tools out there that are a little bit friendlier, little bit nicer, but they do cost money. I like the fact that Eclipse is free. So as I move from different orgs, from one org to the next, I don't have to worry about any licensing issues.
So we come to this site, install the force.com IDE. The first thing we're going to do is we need to install Java. And we go to the Java installation. It's always going to take us to the latest version of Java. The challenge with that is Eclipse, being a free tool, isn't always up to date with the latest version of Java, and you're going to have issues when you try to actually execute Eclipse. So what I do is I always go to the previous release. And in this case, the current version is Java SE nine, so we're going to go down here and take Java SE eight.
So we would click on download here. That would then give us the option to download the specific one we need. We accept the license agreement, and in our case, we're running on Windows 64, so we'll go ahead and download that Java installation application. Once this is done downloading, go ahead and click on it and let Java go through and do its installation. It's going to ask you yes, do you want to do this? And it will then go through and install version eight on your machine. Click next, click next.
Click next. This usually just takes a couple minutes depending on your internet speed. And once that's done, click close, and you have installed successfully the Java installation. We then go back to our instructions from the IDE site, and the next thing we want to do, is then, of course, download Eclipse. We go to the Eclipse link, and you'll see that you're presented with a couple different options. One is the Java EE developers. Eclipse IDE for Java developers, that's the one we want, so we're going to click on that.
We're going to go to the Windows 64. Again, select the link that's appropriate for the operating system that you're running on. And this takes a few minutes. You'll get to a point where you can do a download. Go ahead and click on the download. And as you can see, donations to the Eclipse community are greatly appreciated, so feel free to donate, if that's what you want to do, and if not, that's fine, too. 'Kay, once that's completed, go ahead and click on that. Open it up. You'll see in your Eclipse folder, you've got the Eclipse application there.
You should be able to execute that. Go ahead and extract all those. It'll give you a location where you want to put it. I always just set the defaults. Once Eclipse is finished installing, you will see a directory called Eclipse. Go ahead and click on that directory. You'll then see the Eclipse logo there, click on that. That will start Eclipse. It then gives you an option for a work space. Go ahead and either accept the default or pick a directory that you would like to actually install the workspace in.
And we now have Eclipse up and running. First couple things I do, I typically go over here and click on the little square there in the corner to give me this view. Next thing we need to do, we go back to our installation instructions. Installation instructions say that we need to go in to help, install software, add, and then we need to add this URL into there. So go ahead and copy that. Bring Eclipse back up.
We go to help, we go to install new software. We're then going to add, and what we're going to add is force.com IDE, and the URL that we copied. So we'll go ahead and paste that into there, and we then click okay. That's going to bring up the force.com IDEs that are available. We're going to go ahead and select all, and then click next.
And this will basically complete setting up our tools, so at this point, when this is done, the Eclipse IDE is set up. Got to go through and accept the terms and agreements, as with just about every other software you download nowadays. Once this is complete, we will be ready to actually connect to a Salesforce org. Once it's finished installing, it's going to ask you to restart the Eclipse software. So you need to do that in order to get the force.com IDE installed into Eclipse.
Every time Eclipse comes up, you're going to always be asked what workspace you want to use. So one of the beauties of that is if you're working on a couple different projects, you can actually have different workspaces and you can run multiple versions of Eclipse on your system. The only limitations is, obviously, how much memory you have in your machine. Okay, so we're going to click okay to go ahead and load Eclipse back up. Again, we'll come up with this welcome type screen. I always go over, click restore to take me back to the environment I want to see.
Screen real estate, I like to have more real estate, so I will go ahead and close the welcome part of this. The first thing we now need to do is we need to connect to a developer org or to the org that we're going to be working in. For this example, we're going to set up a developer org and get that ready so that we can then load it into Eclipse. So we'll bring our browser back up. We're going to go to developer.salesforce.com, and the reason for that is we can actually sign up for a developer edition of Salesforce so that we can actually create code in it.
We can create some data, we can do some testing. This is a free version. One thing I will tell you when you sign up, it's going to ask for your name, your company, your role, all of that, and you will get a very nice phone call within 24 hours from Salesforce seeing if they can provide you any assistance. What I usually do is tell 'em look, I'm using this as a practice org. Something I wanted to try, and so I don't really need any assistance at this time. They will mark it that way, and you will not receive any more phone calls.
Once you've filled out all of the information here, first name, last name, your email, you go ahead and sign up. Once you sign up, you will get an email that will look like this. It says thanks for signing up with Salesforce, you need to click on the link below to validate that you are who you say you are. Notice you'll have your username. Once you click on this, it's going to ask you to actually go in and put in a password. You'll get that and you'll be ready to go. 'Kay, once you get to the login screen at login.salesforce.com, once you enter your account and password information, if Salesforce does not recognize the location you're logging into, which, in this case, the first time you're logging in, it will not, it will actually send you a verification code asking you to verify who you are.
So in my case, I've got my cell phone set up. If your cell phone is not set up, it will send it to your email. Once you get that verification code, go ahead and type that in. Hit verify, and you are now logged in to your developer org at Salesforce. It will have your name up at the top and will be ready to start working. Let's go back to Eclipse and what we need to do in Eclipse is we need to now attach this version of Eclipse to the org that we just created.
So we're going to come over to this part of the screen, we'll right click, new, come down to other, see the force.com in the list there, and we're going to go ahead and do a force.com project. Click next. It's then going to ask us for all of those credentials. So we're going to do a project name, whatever you would like to call it. We're just going to call it a deaf class.
You then need to put in your username, your password, and your security token. The username is what you log in with, password's what you log in with. The security token is actually generated by the system and I will go back to the login so that I can show you how to actually generate that security token. Coming back to Salesforce login, we need to actually go to my settings. Go ahead and click close on this and ignore those for now. We're going to go to personal, and in personal, you're going to say reset my security token.
Click on that. Once you click reset here, it is going to send a security token to your email account. So as you can see here, I went ahead and sent that to my email account. Going back to email, I will see that security token. So within a couple minutes, you'll typically receive the token from Salesforce. You could see it has your username here, and then you also have the security token. So we're going to go ahead and copy that security token. Going back to eclipse, we're going to paste that security token there.
I personally don't always remember my username, so I will do the exact same thing. I will go back to the email. In this case, there's my login name, go back to Eclipse, post my login there, and then the only thing I have to remember is my password. 'Kay. There's a couple selections here. Production or developer edition, sandbox, pre-release, and you can specify other. You'll almost always either be working on production developer edition or sandbox. In this case, because we went to the force.com developer site, we're going to be working on the developer edition, so go ahead and leave this as developer edition.
Click next, and that should collect any information from that site. It'll bring you to this screen. It says do you want to just do the defaults? First installation, I always do just the defaults. If you want to create a password recovery, you can do that, so you can just put questions, whatever that is. I'm going to skip that for now. Once this is done, you basically have set up your development environments.
There is one thing that you do need to do here that's easy to forget. But in the force.com, you can either work online or offline. And as you see, we want to work online. So we're going to go ahead and click work online. If you forget to do that, what you'll find is you're making code changes. They don't get saved back to the org. It'll actually be a point of frustration. It'll be like, gosh, I know I changed this. I don't understand why it's not working the way I'm expecting it to. When I go to the org itself, I try executing something. It doesn't work.
That's almost always what has happened, is you're in an offline mode, and you don't even realize it, right? So like right now, we could go back to working offline, but it'll always tell you what you can go to. The other thing to keep note of is in the problems down here, you will get warning messages. It will tell you save locally. So again, that's something to keep your eye on. If the org currently has any code in it at all, you will see those having been loaded into the basic things that we looked at.
We loaded up the classes, pages, we don't have any. We do have trigger. So we do have those triggers there. And that is basically it. We have now installed successfully the Java, Eclipse, and access to our org.
- How Apex works
- Bulkification and triggers
- Systematically debugging your code
- Sets, lists, and maps
- Trigger and trigger handlers
- Batch Apex
- Debugging and logging