Showing posts with label Salesforce Introduction. Show all posts
Showing posts with label Salesforce Introduction. Show all posts

Thursday, 12 November 2015

Salesforce Dev Utility Post #2 : Best Practice -- Force.com Development Naming Conventions

If most people don't mind along with the senior developer then you will have very difficult time persuading them all. In this case I would recommend just keep going with the original convention set forth by the original developer and at least keep things consistent.

If other people are not okay with that as well then you can focus on the ROI of converting already existing project naming convention to language naming convention and present that to the management along with the senior developer. This will most certainly cause some friction.
In conclusion, I would say that language naming conventions are very important because new people coming into your project are more comfortable with the code-base requiring less explanation and causing less friction.

The reason being that language naming conventions are global and project naming conventions are local so people would need more time getting used to it.

As new developers are getting used to the project naming conventions they are bound to mix it up with language naming conventions if that's what they were used to. Code reviews could solve this issue but it is an unpleasant element of going with the project naming conventions nevertheless.

Hence, from that perspective language naming conventions are more important than project naming conventions.

Follow the CamelCase Java conventions, except for VF pages and components start with a lower case letter.

Triggers:
  • § <ObjectName>Trigger - The trigger itself. One per object.
  • §  <ObjectName>TriggerHandler - Class that handles all functionality of the trigger
  • §  <ObjectName>TriggerTest

Controllers:
  • §  <ClassName>Controller
  • §  <ClassName>ControllerExt
  • §  <ClassName>ControllerTest
  • §  <ClassName>ControllerExtTest

Classes:
  • §  <ClassName>
  • §  <ClassName>Test (These might be Util classes or Service classes or something else).

Visualforce pages and components:
  • §  <ControllerClassName>[optionalDescription] (without the suffix Controller). There might be multiple views so could also have an extra description suffix.


Object Names and custom Fields:
  • §  Upper_Case_With_Underscores

Variables/properties/methods in Apex:
  • §  camelCaseLikeJava - more easily differentiated from fields

Test methods in test classes
  • §  test<methodOrFunctionalityUnderTest><ShortTestCaseDesc> - For example, testSaveOpportunityRequiredFieldsMissing, testSaveOpportunityRequiredFieldsPresent, etc.

Working on something that would be used as an app or in some cases just a project? If yes, then do the following:

Prefix all custom objects, apex classes, Visualforce pages and components with an abbreviation so that they are easier to identify (e.g., easier for changesets). For example the WidgetFactory app would have the prefix wf on those. Additionally, when adding custom fields to a standard object they would also be prefixed to identify them as part of the app/package.


The main reason for the Object and Fields Names using Upper_Case_With_Underscores is that when you type in the name field or object with spaces it automatically adds the underscores. Although Apex is case insensitive, always refer to the Objects and Custom Fields in the code as Upper_Case_With_Underscores as well for consistency all around and consistency with what is generated by the SOQL schema browser and other tools. Object and Field Labels (which are generally ignored by code but visible to users) should keep spaces, not underscores.

"Happy Coding"


Monday, 11 May 2015

Install Force.com IDE in Eclipse

First step to start with coding in Salesforce.com is to install the force.com IDE in Eclipse. I will target the new version of eclipse which is Kepler. Force.com IDE is supported in Eclipse Juno as well as Eclipse Kepler.
So, we will start with launching the Eclipse.

then goto Help ->  Software Update / Install new software…



Then Add Force.com site.
  1. Click “Add Site”. The Add Site dialog opens.
  2. Set the Name to “Force.com IDE” and the Location to “http://media.developerforce.com/force-ide/eclipse42“, then click “OK.”

After you add the site, you will get the list of all available plugins, click on force.com and then click Next.
In the Install dialog, click “Next” then accept the terms and click.

follow the instructions and IDE will be installed.
After Installation, Create new Project of type Force.com.

As You can see in above snap following details needed while creating the salesforce project.
  • Salesforce UserName
  • Salesforce Password
  • Salesforce Security Token

 Happy Coding !!



Thursday, 9 April 2015

Salesforce Admin 201 Certification Preparation

  

Let’s make no bones about it the Salesforce Administrator ADM-201 is a tough certification to attain, remembering the Salesforce limits is tough as well as having to stop your thought process running away thinking “I know this can be achieved this way but would it be considered best practice”. There is a fine balance with the Salesforce Administrator exam between knowing too much and knowing to little. This is a certification however where corners cannot be cut, you either know it or you don’t.

Use Your Free Dev Org
To use an analogy from cycling when a reporter once asked Fausto Coppi (a famous cyclist) what it took to be a great champion, he replied “Ride your bike, ride your bike, ride your bike”. The Salesforce equivalent would be “Use your Dev Org, use your Dev Org, use your Dev Org”. It is paramount that you sign up for a free Dev Org (and use it) in order to expand your Salesforce knowledge, try out new functionality, find different ways of reaching a solution and most importantly will back up your knowledge in a practical way. In a perfect world we would all get the entire experience from our Salesforce based roles but this is very rare. Using the Salesforce Dev Org is fun too, like a big jigsaw puzzle.
Resources For Passing Salesforce Administrator Exam

Specific Areas To Pass The Salesforce Administrator (ADM-201)
ü  Standard Objects and Data Model
ü  Organization Wide Defaults (OWD)
ü  Record Types
ü  Salesforce Limits
ü  Role Hierarchy
ü  Security
ü  Roles and Profiles
ü  Lead assignment rules
ü  Reporting & Dashboards
ü  Chatter

Standard Objects and Data Model

Organization Wide Defaults (OWD)

Record Types

Salesforce Limits

Role Hierarchy

Security

Roles and Profiles
ü  Roles 
ü  Profiles 

Lead assignment rules

Reporting & Dashboards

Chatter
ü  Chatter (CoD)

For Preparation refer below links :

Sample Mock Question Part #1. (Click Here To Download)
Sample Mock Question Part #2. (Click Here To Download)
Sample Mock Question Part #3. (Click Here To Download)

Happy Learning !!


Monday, 23 March 2015

Visualforce table Export to excelusing HTML Table & jQuery

This articles lets you know how to export data using HTML table & jQuery :

Apex Class :

public with sharing class ExportToExcel{
  
     public String exportDataString {get; set;}   

     public ExportToExcel() {} 

   //Apex Page refference methods from apex can used to redirect from one page to another page.
     public ApexPages.PageReference goToExportPage() {
        return Page.ExportToExcel;
     }   
}

Visual-force page: To Display Table

<apex:page controller="ExportToExcel" sidebar="false" title="Export">
     <!-- Static Resource Includes: Jquery and css files  -->
    <apex:includeScript value="{!JSENCODE(URLFOR($Resource.JQuery,'js/jquery-1.5.2.min.js'))}"/>
    <apex:includeScript value="{!JSENCODE(URLFOR($Resource.JQuery,'js/jquery-ui-1.8.13.custom.min.js'))}"/>
    <apex:stylesheet value="{!JSENCODE(URLFOR($Resource.JQuery, 'css/redmond/jquery-ui-1.8.11.custom.css'))}"/>

    <style>
        #newspaper-b {
            font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
            font-size: 12px;
            margin: 45px;
            width: 480px;
            text-align: left;
            border-collapse: collapse;
            border: 1px solid #69c;
        }
        #newspaper-b th  {
            padding: 15px 10px 10px 10px;
            font-weight: normal;
            font-size: 14px;
            color: #039;
        }
        #newspaper-b tbody {
            background: #e8edff;
        }
        #newspaper-b td {
            padding: 10px;
            color: #669;
            border-top: 1px dashed #fff;
        }
        #newspaper-b tbody tr:hover td {
            color: #339;
            background: #d0dafd;
        }

    </style>
     <apex:sectionHeader title="Export Table" />

     <script type='text/javascript' language='javascript'>
        var j$ = jQuery.noConflict();
        function exportTableData(){
            j$(".exampleDataToExport").val(j$("#containerTable").html());
            goToExportPage();
        }
     </script>
    <apex:form >
        <a style="text-decoration: underline;cursor: pointer;margin-left:480px;font-weight:bold;font-size: 15px;" class="dummyCustomExport"  onclick="exportTableData()" title="export"><b>Export</b></a>

        <div id="containerTable">
            <table id="newspaper-b" class="dummyExportTableClass" summary="2007 Major IT Companies' Profit">
                <thead>
                    <tr>
                      <th scope="col">Company</th>
                      <th scope="col">Q1</th>
                      <th scope="col">Q2</th>
                      <th scope="col">Q3</th>
                      <th scope="col">Q4</th>
                    </tr>
                </thead>
                <tbody>
                  <tr>
                      <td>Microsoft</td>
                      <td>20.3</td>
                      <td>30.5</td>
                      <td>23.5</td>
                      <td>40.3</td>
                  </tr>
                  <tr>
                      <td>Google</td>
                      <td>50.2</td>
                      <td>40.63</td>
                      <td>45.23</td>
                      <td>39.3</td>
                  </tr>
                  <tr>
                      <td>Apple</td>
                      <td>25.4</td>
                      <td>30.2</td>
                      <td>33.3</td>
                      <td>36.7</td>
                  </tr>
                  <tr>
                      <td>IBM</td>
                      <td>20.4</td>
                      <td>15.6</td>
                      <td>22.3</td>
                      <td>29.3</td>
                  </tr>

                </tbody>
            </table>
        </div>
        //action function redirects to another page.
        <apex:actionFunction name="goToExportPage" action="{!goToExportPage}"/>
        <apex:inputTextarea id="ExportDataString" value="{!exportDataString}" styleClass="exampleDataToExport" style="display:none"/>
    </apex:form>
</apex:page>

Visual-force page: Export page(Export as Excel)


<apex:page controller="ExportToExcel" contentType="application/vnd.ms-excel#export.xls"  title="Export To Excel" cache="true">
  {!(exportDataString)}
</apex:page>

JQuery UI CDN :  https://code.jquery.com/ui/1.11.4/jquery-ui.js
Jquery JS : https://code.jquery.com/jquery-1.11.2.js

Please feel free to ask any question .....

                                                          Happy Learning !!