Salesforce provides a framework for testing apex code. Testing is the key to successful software development. Before deploying apex code, try to cover as many lines of code as you can. At least 75% of your Apex code must be covered by unit tests else your code will not be deployed to production. Why Test? You should not write test classes by keeping in my mind just to cover 75% of your code but should always try to cover your entire code before deploying to production. Test provides assurance of functionality Test reduce cost of change Test encourage modular and reusable code Test help document expected behavior Test + Code = less likely produce the bug What to Test? Things that should happen to happen (Positive) : Positive testing is a way to test expected behaviour of code that you wrote is suppose to do. Things that should not happen to happen (Negative) : This is the hardest and important thing to test that verify if the error messages are correctly produced along with the positive working of test cases, within the limits cases. User Access : This is basically the manual testing, which we perform by seeing the aspect of end-user test is done when we think of user interaction. This type of test is done by hand via insert, update, delete and undelete the records. Exceptions : Exception testing tests expected behaviour of code when an user with restricted access to sObjects are used in code. Bulk Testing : This test comes in when a class, trigger or any apex code insert and update data in bulk. We need to test the class by creating more than one record in multiple scenarios. Test Structure Principles for Best Practices Principle #1 Use of Asserts : Assert is the method of System Class. It is an important method for test class which is used to check the expected result of test scenario. “A test without assert method isn’t a test, it’s code execution.” There are three in-built assert methods which are as follows: assert(condition, message) assertEquals(expected, actual, message) assertNotEquals(expected, actual, message) Every test method should include at least one assertion. Principle #2 Use startTest() and stopTest() startTest() methods are used to reset governor limits. The code between Test.startTest and Test.stopTest executes in fresh set of governor limits that...

The Salesforce Certified Platform App Builder exam is for them who want to grow in their skills and knowledge in designing, building, and also want to implement custom applications using the predeclared customization capabilities of the Force.com platform. In June 2015, Salesforce University introduced the three new certifications: Salesforce Platform App Builder Platform Developer I Platform Developer II Salesforce University splitting the Developer track into declarative certification and two programmatic certifications. The Salesforce Platform App Builder certification is like to the Certified Force.com Developer credential. Here are some concepts for understanding to pass the exam: Design the Data model, user interface, business logic and security for custom applications Customize applications for mobile use Design reports and dashboards Deploy custom applications The Platform App Builder Exam is an only 90-minute exam. The exam contains 60 single or multi-select questions. The passing score is 63%, or 38 correctly answered questions. How to prepare for the Salesforce Platform App Builder Certification Exam Review the concepts in the Platform App Builder Study Guide & Group Objectives by Their Weightings as given below: Perform a Self Assessment on the objectives and ID Areas Needing Knowledge Improvement Increase Your Knowledge Building Applications with Force.com Part 1 Building Applications with Force.com Part 2 Grab a Personal Developer Org and Practice Those Concepts Familiarize yourself Mock Questions Daily Routine: Take Mock Exams and Study Notes Tips The App Builder Exam is very broad but it does not go extreme depth, So you will need to have an overview of a lot Salesforce & Force.coms features. Make sure that go through each section in the study guide and revise accordingly. The social section is worth 3% of the exam so you can only expect 1 or 2 questions. Make sure that read other guides as well, each person has a different take on the exam and may provide different insights. The process of elimination is yours! If you can not work out which answer is right, try and work out which answer is wrong! To get more information about Platform Developer I. Click here ...

Salesforce provides a framework for testing apex code. Testing is the key to successful software development. Before deploying apex code, try to cover as many lines of code as you can. At least 75% of your Apex code must be covered by unit tests else your code will not be deployed to production. Why Test? You should not write test classes by keeping in my mind just to cover 75% of your code but should always try to cover your entire code before deploying to production. Test provides assurance of functionality Test reduce cost of change Test encourage modular and reusable code Test help document expected behavior Test + Code = less likely produce the bug What to Test? Things that should happen to happen (Positive) : Positive testing is a way to test expected behaviour of code that you wrote is suppose to do. Things that should not happen to happen (Negative) : This is the hardest and important thing to test that verify if the error messages are correctly produced along with the positive working of test cases, within the limits cases. User Access : This is basically the manual testing, which we perform by seeing the aspect of end-user test is done when we think of user interaction. This type of test is done by hand via insert, update, delete and undelete the records. Exceptions : Exception testing tests expected behaviour of code when an user with restricted access to sObjects are used in code. Bulk Testing : This test comes in when a class, trigger or any apex code insert and update data in bulk. We need to test the class by creating more than one record in multiple scenarios. Test Structure Principles for Best Practices Principle #1 Use of Asserts : Assert is the method of System Class. It is an important method for test class which is used to check the expected result of test scenario. “A test without assert method isn’t a test, it’s code execution.” There are three in-built assert methods which are as follows: assert(condition, message) assertEquals(expected, actual, message) assertNotEquals(expected, actual, message) Every test method should include at least one assertion. Principle #2 Use startTest() and stopTest() startTest() methods are used to reset governor limits. The code between Test.startTest and Test.stopTest executes in fresh set of governor limits that means your setup code will not interfere and give you false positives (or negatives) surrounding governor limits. stopTest() method focuses on asynchronous code to complete. In general, one should follow these steps while writing test class: Create your test data Start the test Use that test data within your tested...

The Salesforce Certified Platform App Builder exam is for them who want to grow in their skills and knowledge in designing, building, and also want to implement custom applications using the predeclared customization capabilities of the Force.com platform. In June 2015, Salesforce University introduced the three new certifications: Salesforce Platform App Builder Platform Developer I Platform Developer II Salesforce University splitting the Developer track into declarative certification and two programmatic certifications. The Salesforce Platform App Builder certification is like to the Certified Force.com Developer credential. Here are some concepts for understanding to pass the exam: Design the Data model, user interface, business logic and security for custom applications Customize applications for mobile use Design reports and dashboards Deploy custom applications The Platform App Builder Exam is an only 90-minute exam. The exam contains 60 single or multi-select questions. The passing score is 63%, or 38 correctly answered questions. How to prepare for the Salesforce Platform App Builder Certification Exam Review the concepts in the Platform App Builder Study Guide & Group Objectives by Their Weightings as given below: Perform a Self Assessment on the objectives and ID Areas Needing Knowledge Improvement Increase Your Knowledge Building Applications with Force.com Part 1 Building Applications with Force.com Part 2 Grab a Personal Developer Org and Practice Those Concepts Familiarize yourself Mock Questions Daily Routine: Take Mock Exams and Study Notes Tips The App Builder Exam is very broad but it does not go extreme depth, So you will need to have an overview of a lot Salesforce & Force.coms features. Make sure that go through each section in the study guide and revise accordingly. The social section is worth 3% of the exam so you can only expect 1 or 2 questions. Make sure that read other guides as well, each person has a different take on the exam and may provide different insights. The process of elimination is yours! If you can not work out which answer is right, try and work out which answer is wrong! To get more information about Platform Developer I. Click here ...

Google Map Integration Integrating google maps into Salesforce Description of the requirement: Starting with description of the Project we have worked upon, there’s an app we created for searching and showing Account’s location on the Map and knowing a route map from one location to another location via some locations(Checkpoints). Solution we came with: For the requirement we used Google maps api which is in Javascript format. There are some predefined javascript functions used in the Google map api. We used Google Maps library whoz source is coming from a link i.e., “https://maps.google.com/maps/api/”. There are several Javascript functions we used here which are as follows: Function to get the current location of the User by using the browser’s location. Get the current location of the User by using the browser’s location: var geocoder; var map; function initialize(){ geocoder = new google.maps.Geocoder(); console.log(lon+’***latlon–‘+lat ); var latlng = new google.maps.LatLng(lat, lon); console.log(‘***latlon–‘+latlng); var myOptions = { zoom: 12, center: latlng, mapTypeId: ‘roadmap’ /* , mapTypeId: google.maps.MapTypeId.TERRAIN */ } map = new google.maps.Map(document.getElementById(“map”), myOptions); Here we used “google.maps.Geocoder();” to access Google Maps API geocoding service. We created an apex class method which will take Address of the Account as a string and will return a Geolocation for that address i.e., in Latitude and longitude of the string address passed in the function as a parameter to it. Suppose a string will be as shown below: public Account accObj{get;set;} // This is a getter setter method contains Account record. String address = accObj.BillingStreet+accObj.BillingCity+accObj.BillingPostalCode+accObj.BillingCountry; Now we used the below method to get the Latitude & Longitude: Get the Latitude & Longitude: public static String getLatitudeLongitude(String address){ String location=”; try{ Double latitude = null; Double longitude = null; Http httpGetRequest = new Http(); HttpRequest httpReq = new HttpRequest(); system.debug(‘******Address—‘+address); address=address.replaceAll(‘ ‘,’+’); address = address.replace(‘\r\n’, ‘ ‘); address = address.replace(‘\n’, ‘ ‘); address = address.replace(‘\r’, ‘ ‘); system.debug(‘******After Address—‘+address); httpReq.setEndpoint(‘https://maps.googleapis.com/maps/api/geocode/json?key=’+key+’&address=’ +address + ‘&sensor=false’); //Authentication to google api httpReq.setMethod(‘GET’); httpReq.setTimeout(6000); HttpResponse httpResponseAddress = httpGetRequest.send(httpReq); system.debug(‘res body: ‘ + httpResponseAddress.getBody()); JSONParser parser = JSON.createParser(httpResponseAddress.getBody()); while...

I am writing this blog out of my experience to share the key details of the different IDEs I have used while programming in Force.com environment. This might help an experienced or newbie developer in choosing the right IDE to code.My favorite and most probably every programmers most loved IDE. Eclipse is famous as a Java Integrated Development Environment (IDE). Salesforce You can easily combine language support and other features into any of our default packages, and the Eclipse marketplace allows for virtually unlimited customization and extension. Eclipse give a feel of traditional desktop based programming from developer end and in backend it saves all in Salesforce Cloud. Eclipse for Salesforce: To code apex in eclipse you have to first install force.com IDE in your eclipse in order to sync your local server with salesforce server. What force.com IDE can do : Customizable Folders Structure: No more limitations for files or folders structures. Now developers can organize them in whatever way they want. Apex Code Completion: Save time, improve the coding velocity, and avoid making mistakes with Code Completion functionality for Apex. Anonymous Apex Execution: Test new solutions, debug your code or work with your organization using the Anonymous Apex with all of the code editing features you’ve got used to. Quick Search of a Current Selection: Once you select any text in your code all its occurrences within the document will be highlighted and marked on the scrollbar automatically. Debug Logs: When debugging code you usually execute Anonymous Apex, perform some actions in the UI or start scheduled jobs which then produce lots of logs for you to go through. In most cases your actions would provide you whatever information you need pretty easily but sometimes you need only some specific logs – with very long duration, very small or very big logs, failed or succeeded logs and so on. Find and replace Find, preview, and replace text as you type in a file or across all your projects. Latest Features: Execute Apex Test Suites Enjoy Optimized Test Execution See Apex Test Results More Quickly Enabled code­ coverage highlighting in Apex classes Provided whitelist filtering for user and request­type debugging in the Apex Debugger Share Apex Debugger licenses among your sandbox orgs Enabled Eclipse’s Java development tools (JDT) icons for Apex variables in the Apex Debugger How To Install : These instructions show you how to install the Force.com IDE into your existing Eclipse distribution or upgrade from a previous version. Prerequisites: To install Force.com IDE you must have these requirements filled: 1. Java SE Development Kit (JDK) must be installed in the system in order to install Eclipse.(Download JDK) 2....

The Atom Atom is a text editor that’s modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file. What Atom IDE can do : Cross­ platform editing Atom works across operating systems. You can use it on OS X, Windows, or Linux. Built­in package manager Search for and install new packages or start creating your own—all from within Atom Smart auto completion Atom helps you write code faster with a smart, flexible autocomplete. File system browser Easily browse and open a single file, a whole project, or multiple projects in one window. Multiple panes Split your Atom interface into multiple panes to compare and edit code across files. Find and replace: Find, preview, and replace text as you type in a file or across all your projects. Latest Features : Most Recently Used Tab Switching. Opening and Managing Files from the Tree View. Adding Project Folders from the Command Line. Keyup Keystroke Support in Keybinds. Crash Recovery Environment Per Window Packages Using Async Git Electron Update More Ways to Move Text Added the ability to update an Atom window’s environment from the terminal by executing the same command with an updated terminal environment. How To Install : To install Atom in your system got to httpss://atom.io link and click the windows installer button it will start your downloading. After downloading the setup install it in your system but in order to configure atom for salesforce first download github from httpss://desktop.github.com/ after downloading github install it as well in your system. That’s not it after installing Github you have to install Mavensmate­ app too to make the atom work for Salesforce. To download Mavensmate please follow this link httpss://desktop.github.com/. After all these apps are installed than configure atom to work for your system. Configuration : Open File > Setting… > +Install > Search for “MavensMate” > Install Or from Command Line : apm install MavensMate­Atom When you are working on salesforce please make sure that mavensmate is also running. Now to make changes in the settings. MavensMate > Settings > Global Settings And for Plugin setting: MavensMate > Settings > Plugin Settings Create a Project : To create your first MavensMate for Atom project: 1. Be sure to configure your mm_workspace: MavensMate menu > Settings > Global Settings 2. MavensMate > New Project To run MavensMate commands, use the Atom command palette (on OSX: command+shift+p) or use the .MavensMate menu in...

I am writing this blog out of my experience to share the key details of the different IDEs I have used while programming in Force.com environment. This might help an experienced or newbie developer in choosing the right IDE to code. Sublime Text is a sophisticated text editor for code, markup and prose. You’ll love the slick user interface, extraordinary features and amazing performance.We are familiar with the Force.com IDE which is based on the Eclipse platform which we use to code, compile, test, package and deploy Salesforce projects. Today we can look forward to another cool tool for Salesforce Developers – MavensMate. It is a powerful open source tool for building Force.com IDEs. It helps us to develop Salesforce applications easily regardless of the platform or text editor. Most of us are using the beloved Sublime Text for coding our projects. My favorite and most probably every programmers most loved IDE. Eclipse is famous as a Java Integrated Development Environment (IDE). Salesforce You can easily combine language support and other features into any of our default packages, and the Eclipse Marketplace allows for virtually unlimited customization and extension. Eclipse give a feel of traditional desktop based programming from developer end and in back end it saves all in Salesforce Cloud. Let’s see how to integrate MavensMate with Sublime Text to make it a powerful development environment like (or better than) the Force.com IDE. What Sublime Text can do Go to Anything Use Go to Anything to open files with only a few keystrokes, and instantly jump to symbols, lines or words. Triggered with Ctrl+P, it is possible to: Type part of a file name to open it. Type @ to jump to symbols, # to search within the file, and : to go to a line number. These shortcuts can be combined, so tp@rf may take you to a function read_file within a file text_parser.py. Similarly, tp:100 would take you to line 100 of the same file. Multiple Selections: Make ten changes at the same time, not one change ten times. Multiple selections allow you to interactively change many lines at once, rename variables with ease, and manipulate files faster than ever.Try pressing Ctrl+Shift+L to split the selection into lines and Ctrl+D to select the next occurrence of the selected word. To make multiple selections with the mouse, take a look at the Column Selection documentation. Command Pallette: The Command Palette holds infrequently used functionality, like sorting, changing the syntax and changing the indentation settings. With just a few keystrokes, you can search for what you want, without ever having to navigate through the menus or remember obscure key bindings.Show the Command Palette with Ctrl+Shift+P. Command-Pallette Distraction Free Mode: When you need to focus, Distraction Free Mode is...

As we all know Lightning has been added to Salesforce very recently and it is the future of Salesforce. So lot of people who are new to Lightning but have the curiosity to learn it sometimes find it difficult to understand. I realised that the best way to start would be by describing what are the differences between Salesforce Lightning Design System and Salesforce Lightning Components Framework. So in this blog I will try to explain what are the major differences between Salesforce Lightning Design System and Salesforce Lightning Components Framework and hopefully it will clear out most of the doubts that a new developer is having regarding The Lightning Framework. Introduction to Salesforce Lightning Design System It is a css framework which is used for creating dynamic web apps. By Using SLDS We can make our apps responsive and can also provide Look and feel similar to the Lightning Experience. Steps to install the SLDS Unmanaged Packaged:For using SLDS in our Salesforce org. First We need to install the Latest Salesforce Lightning Design System unmanaged packaged as a static resource zip file. Log into your Developer Org. Open the Salesforce Lightning Design System in a Separate window. Go to the Download Section. Click on the latest unmanaged package Now click on Install it. After Completing the above steps the package will get installed into your org. Benefits of using Salesforce Lightning Design System: By using SLDS it’s easier to build apps which are responsive and also have the look and feel similar to Lightning Experience. It is compatible with multiple browsers like Google Chrome, Latest Mozilla Firefox, Latest Safari Latest Internet Explorer 11 and above . It provides a robust grid system because of which It is easier to build responsive layouts that works elegantly across different screen sizes. The CSS is fully namespaced with the slds- prefix to avoid CSS conflicts. Introduction To Lightning Components Framework It is built using Open Source Aura Framework. By Using Aura Framework We can build apps completely independent of the Data present in our Salesforce org. Benefits Of Lightning Components Framework : It provides an out-of-the-box set of components for building apps When we use Lightning Components Framework We do not need to worry about the optimization of our apps for different devices as Components take care of that by themselves. It uses the stateful client and stateless server architecture which uses Javascript on client side for managing UI component metadata and Application data. It uses event Driven architecture which enhances the decoupling Between components. It supports the latest browser technology such as HTML5,CSS3. Use Of Developer Console:The Developer Console provide us the tools which are Used...