Tuesday 7 October 2014

How to Indent / Align / Format Apex Code in Salesforce without using eclipse or any other tools

Most of the Salesforce developer who are not using the Developer Console may not aware how to Indent / align the code. They generally go for external site or applications to intend their code.

If you write Apex class / Apex Trigger / Visualforce page using the normal User Interface, then you code is not auto formatted as well when reading the code is very ridiculous. The coding should always readable to everyone for this you need to indent your code. We can indent the coding using Developer Console.

Here is a simple steps to indent your code using the developer console.

1.    Click “Developer Console” from the Set up menu.



2.    Then Click File à Open à Classes à Select your class that you want to indent.




3.    Select all or just a section of code to indent

4.    Press Shift + TAB




5.    Save


That’s it...! Your code is Indented now...! 

7 comments:

  1. Pretty cute. Unfortunately it kinda leaves these types of comments mangled:


    /*
    First step is to create a context for PSI_LREngine, by specifying parent and child objects and
    lookup relationship field name
    */

    ReplyDelete
  2. Actually this page mangled my mangled comment. The first '/*' is indented 8 spaces or so and the rest of the comment including the ending '*/' starts in column 1.

    ReplyDelete
  3. Nice knowledge gaining article. This post is really the best on this valuable topic. salesforce

    ReplyDelete
  4. Thanks for taking the time to discuss that, I feel strongly about this and so really like getting to know more on this kind of field. Do you mind updating your blog post with additional insight? It should be really useful for all of us. buku mimpi

    ReplyDelete
  5. It helps in business process standardization ensuring that you can carry out proper salesforce training. salesforce interview questions

    ReplyDelete

Activities: Assign Tasks to a Queue Salesforce Lightning

Salesforce announced to assign Tasks to a Queue beginning from Spring'20 release. How does it work? In Setup, enter Queues in th...