Author Archives: admin

Best Programming Practices

Any code when written in a clean, easy to understand and formatted way is easily readable and accepted by everyone.

It is essential for everyone to easily understand the code one writes as same projects can involve participation of multiple programmers. For easy identification and understanding of the code and code flow by everyone involved, it is essential that the code is structured, clean, and easily maintainable.

Explained below are some of the practices to write clean and understandable code.


Commenting and Documentation

For any software project reliable documentation is crucial. Commenting and documentation helps one analyze what’s happening inside the code. This is very crucial for the one who is examining the code for the very first time. Writing comments for methods or functions is good for understanding its purpose. They can quickly show what a complex function is doing.

However, don’t write unnecessary comments as it would make your code messy. Obvious commenting does more harm than good. Comment should describe only what the method is doing or why it’s written. It can also describe the purpose of writing the program in a nutshell at the beginning of a class or module.


Naming Conventions

Adopting a consistent naming convention in your program is always a sensible and thoughtful practice.  It’s a set of rules for picking the character flow to be used for identifier, which signify variables, functions & methods. It makes it easier to understand the purpose of using that variable / function / method. If one’s a beginner, it’s a good practice to give meaningful names to your variables, methods, functions etc. instead of vague combinations of alphabets and numbers. Using camelCase and underscores is a widely popular approach. Use of camel case is to be preferred  as this does not create confusion between salesforce api names and variable names in case of apex code.


Consistent Indenting

There’s nothing worse than reading a piece of code that is poorly formatted. Indenting makes your code looks neat and clean. It is easy to understand the flow of program, the link between control flow constructs such as loops and codes written inside and outside of them.


Keeping it simple

One should keep their code as simple as possible. Avoid writing complex code for simple logic. Try breaking down your code in multiple methods if the logic is getting too complicated for a single module.

Ideally a method or a function should not have more than 40-50 lines of code, excluding comments.

Modules like servlets, triggers and callouts should not have any logic written in them. All the logical operations should be performed in a helper lass.



It is not advisable to use “hard-coded” values referring to environmental parameters, such as absolute file paths, file name, user name, host name, URLs etc. Else, the application might not run on a host with a different design. An efficient programmer should parametrize such variables and configure them as per the hosting environment outside of the application.

The best way to do it would be to maintain all the required constants in a single file which is easily configurable without making any code changes.


Loops and conditional statements

Beware of using loops and conditional statements in your code! Choose right loops at the right place in order to save code’s execution time.

Too many nested blocks of code can reduce code efficiency and readability drastically.


Omit unwanted code

It’s very common to find a block of code commented inside the program. It’s not going to do any harm to your program but bloats the code unnecessarily, so try not to keep such code. In addition, since this code is not going to be executed or compiled there is no difference between commenting out and deleting that code. Deleting commented codes makes your entire program looks cleaner.

In case of future necessity of the commented blocks, maintain additional backup along with the code repositories.


Do not just copy and paste code

If you have a snippet of, say, seven lines of code that do one thing, and you want to do it again for another module, don’t just copy and paste the code. Instead, make a function and to make it reusable. It’ll keep your code simple.


Code versioning

Code Versioning, popularly known as version control, is the management of the changes made to computer programs, documents and other collection of information.

In computer programming, it refers to the process of tracking & controlling the changes made to the source code.

Version control becomes very important especially when working in a big team as this saves additional time that one might require for code merging and also one can easily backtrack in case of errors.


Code versioning is to be done for every project using available resources like Gitlab, Github, Assembla, etc.

Posted in Agile, Apex Development, J2EE, JAVA, Organization Culture.

View State

View State:  As the name suggests, is an error of View State. “Maximum view state size limit (135KB) exceeded” is the error message pertaining to “View State” error and here follows a brief detailing of the issue.

View state holds the state/size of the visual force page that includes the components, field values and controller state. This is important in the light that salesforce provides only a standard size of 135kb for any individual page. If the size of a particular page exceeds 135kb, the page will throw a view state error.

A screenshot showing a view state error in salesforce

Continue reading

Posted in CSS, Salesforce, salesforce administrator, salesforce certified, salesforce certified developer, Salesforce Challenges, salesforce customization, salesforce development, Tagged with , , , , .

jQuery tutorial for beginners

What is jQuery?

jQuery is a lightweight, “write less, do more”, JavaScript library. jQuery is a fast, small, and feature-rich JavaScript library. It makes HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. jQuery is absolutely amazing. It’s cross-browser, easy to learn, and makes adding interactivity to your website a breeze.

How to setup jQuery file with html

Before we can do anything, we need to establish our file and link it to our HTML document. First, we will create our plugin file and put it in the “js” directory of our website. It is traditional to start our filename with “jQuery,” followed by the actual plugin name, so we will call this “jquery-hello.js”.
Continue reading

Posted in Agile, CSS, HTML/CSS, Java Script, UI. Tagged with , , , , .

Javascript Frameworks for Salesforce Lightning Design System

Salesforce has recently launched a new User Interface that is Salesforce Lightning Design System. It gives us very sharp and clean UI. By add JavaScript we can make our Lightning UI even more sharp.Here you can find JavaScript Frameworks  which useful to make best design.

1).Appiphony Lightning JS :

Appiphony Lightning

Appiphony Lighting JS(ALJS) gives harness with jQuery Library and Ember to deliver a rich UI experience to our Salesforce Lighting Design System.ALJS is implemented and maintained by Appiphony.

Click here to Getting Started with ALJS.

2).Lightning Dart:

Lightning Dart

The library for implementing web applications based on the CSS framework Salesforce Lighting Design System is Lighting Dart.Here we can find css,icons and fonts which are useful while implement Web Applications.

Lightning Dart gives the most complete component functionality for SLDS. Dart compiles into Javascript (“Dart – the better Javascript”), For business functionality we can write the code in Dart or in Javascript directly – or any language which can call Javascript.

Click here to Getting Started with Lightning Dart.

Posted in salesforce administrator.

Visual Flows In Salesforce


Visual Flows in Salesforce

Hearing the word flow in salesforce we start thinking about the workflow i.e. defining criteria and firing action. So the question arise that weather flow is the amplified version of workflow or not? So the answer is a big “no”, flow is completely different form the workflow. Workflow let you automate your process letting you select the objects, defining the criteria and based on that criteria firing the immediate or a time dependent actions but this is not the case with the visual flows, visual flows structure a collaboration between you and Salesforce. They were created to be interactive and perform best in situations where system and user have something to contribute.

Continue reading

Posted in app development, Offshore, Salesforce, salesforce certified developer, salesforce community implementation, salesforce consultant, salesforce development, salesforce Tips & Tricks, Visualforce. Tagged with , , .

Dynamic Gauge in salesforce

Salesforce provide us standard functionality to create Reports and dashboards to represent record in diagrammatic form. Sometimes we face the requirement to represent our data in diagrammatic Form on visual force page in some specific type of diagram we represent it using chart. Salesforce provide us Bar chart, Pie chart, Gauge chart, Radar charts

Here I am going to explain how we can represent specific field data in the form of gauge chart. To achieve this requirement we need four things basically. First we should have an object whether its standard or custom object, a field associated with that object that should hold any numeric Value, apex controller, apex class.

I will start with object lets say I have a standard controller Account where I have a custom field Score and I need to represent that score in the form of gauge. Whenever page loads that value represent in the form of gauge and whenever the fields value changes the gauge should reflect that Change.

Continue reading

Posted in Apex Controller, apex develeopment, Apex Development, Dynamic Gauge In Salesforce, app development, Offshore, HTML/CSS, Salesforce, salesforce administrator, salesforce certified, salesforce certified developer, Salesforce cloud Implementation, salesforce community implementation, salesforce consultant, salesforce customization, salesforce development, Salesforce Dynamic Gauge,, UI, Visualforce. Tagged with , , , , , .

Google Campaign Keywords Data in Salesforce

Google AdWords provides you with a unique ID, called a “GCLID,” for every click that comes to your website from an AdWords ad. By querying “GclId” you’ll be able to see which keywords (Search String) are contributing not just to new lead submissions, but, more importantly, to actual sales.

How to Retrieve Keywords

Step 1:

You need to have an AdWords manager account to apply for access to the API. If you don’t already have a manager account, you will need to create one.

For Create new Manager Account follow the link.

Step 2:

Adwords API access:

For Adwords API access we need to submit the details, after logged in to your manager account:

Go to Gear IconàAccount Settings-àAdwords API Center.

Google Adwords API Center
Continue reading

Posted in Apex Development, app development, Offshore, Learn Salesforce, Salesforce, salesforce administrator, Salesforce Challenges, Salesforce cloud Implementation, salesforce connectors, salesforce consultant, salesforce customization, salesforce development, salesforce Tips & Tricks, Tagged with , .