Pages

Thursday, October 6, 2016

Salesforce: Coding Editors

We discussed about Trigger syntax earlier. This blog, we'll continue with coding editor. To write a trigger, you need in a 'good' coding editor. Salesforce provide option of coding editors with its own benefits, from online editor within Salesforce environment until desktop application.

Please note that you can only write / edit code not directly in Production org. But you need to deploy from a sandbox or developer edition org., but we'll not discuss that in this blog.

1. Setup Menu
Setup | Customize | Object Name (such as Lead, Account, etc) | Triggers - click New button to create new trigger or Edit link to edit existing trigger.

This is the most basic editor, but also the most easiest and quickest way to code. You do not need to install anything, just login to Salesforce and make sure you have the right permissions.
When you create new trigger from here, it will provide basic trigger syntax, but no coloring, auto complete and etc. that offered by more advanced coding editor. Because as this is online coding, you need to have good internet connection.



2. Developer Console
Login to Salesforce, click your name at top right menu | Developer Console - this will open a popup window for Developer Console. Click File | New | Apex Trigger to create new trigger, or File | Open to open existing trigger.



Provide Name and select a sObject to start create new trigger.


Same as coding editor from setup menu, Developer Console is online tool so you do not need to install anything. But, compare to editor in setup menu, Developer Console have more advantages, from: color coding, auto completion, it even tell you if you have syntax error, or field not available online (see Problems tab from above screenshot).

Within Developer Console, you can run SOQL query from Query Editor, but you need to click few menu to get the object schema: File - Open - Objects - object name.



3. Force.com IDE
Follow this step to install Force.com IDE to your computer. This is the most common coding editor use by Salesforce developers. Force.com IDE is a plug-in for Eclipse to interact with Salesforce, this mean you need to setup Eclipse in your computer, then add the plug-in.

It is much more powerful then online coding editors mentioned above, on top of features offered by online editor, with Force,com IDE you can do deployment between org. (in comparison with Change Set only for org. related within a Production org.), and many more.



Although this tool is mean for developer, but admin also can take advantages of this tool to search or edit metadata, watch this on YouTube Hands-on Training: Get started with the Force.com IDE for Admins.

The only issue I always heard that this tool is pretty heavy, that's mean you need to have a powerful computer, if you are using Windows machine, you should run 64-bit OS, my experience running Force.com with 32-bit Windows machine is not really, very slow and keep hanging.

Force.com IDE offer more advanced SOQL by showing object schema.



4. MavensMate
Same as Force.com IDE, you need to install MavensMate on your computer, it is also a plug-in that you need to add on top other editor, but instead of Eclipse, with MavensMate you can choose to use Sublime Text 3, Atom, or Visual Studio Code.

Follow this link to install MavensMate. This tool is not really by Salesforce, but it is open source project. MavensMate getting more popularity recently, according to David Liu said this is the best coding editor to code Salesforce.

This tool offer about the same functionality with Force.com IDE, but in different layout and setting. 



Some user do not like Force.com IDE, because of (some items refer from An Easier Way to Delete Apex Classes From Production):
  • The Force.com IDE is very ‘heavyweight’ and is known for being quite buggy sometimes and unpleasant to use
  • They have a number of dependencies (a compatible version of Java, different IDE version etc)
  • Connectivity to Salesforce via the Force.com IDE may be an issue
  • It's very slow when you are using Windows 32-bit machine.

5. Others IDE
I'll not go to the detail for each others IDE, but here is the list:
For complete other IDE, refer to this blog by Jitendra Zaa.


No comments:

Post a Comment