Month: March 2015

Implementing Continuous Integration Using Jenkins and Git for Salesforce Development

Continuous Integration (CI) is a development practice the allows developers to check-in their changes into a shared repository unlimited number of times. Each check-in is then verified by an automated build system, thus eliminating the changes of breaking some other part of the application while fixing one part.By implementing Continuous Integration, you can detect errors quickly and locate them more easily. I always recommend to implement Continuous Integration in any kind of software projects. I personally implemented CI multiple times for Java and C++ projects in my career. Now last week, I implemented the same for Salesforce development. In today’s post, I will explain how to do that.Below are the prerequisite softwares -ANT – You can download the software from here.Salesforce Migration Tool – Please check the detail steps @ http://www.salesforce.com/us/developer/docs/daas/Content/forcemigrationtool_install.htmGit – You can download the software from here.Eclipse.Before we go further, I recommend you to go through the below posts to understand the concept.Version Controlling in Salesforce with Git + Eclipse.Salesforce Deployment Guide using ANT Migration Tool.Best Practices – Continuous Integration Techniques.Below picture will give you a high level overview about what I am going to achieve by implementing CI.Step 1 – Install Jenkins on your local machine by downloading the Java Web Archive (.war) from here. Once downloaded, execute the below command from the directory where you have saved -java -jar jenkins.warAfter that open your browser and go to http://localhost:8080/. You will...

Read More

Lightning strikes Trailhead – Fun way to learn Lightning

Trailhead is one of my favourite approach to learn new stuffs from Salesforce in an interactive way. I highly recommend employers to encourage all it’s developers and administrators to check trailhead and learn new stuffs.Trailhead brings a new module “Lightning Components” which will help developers to understand lightning concepts. In today’s post, I will review this new module “Lightning Components”.This module comes with 9 different sub modules. All the sub modules are organised so well that at the end of 9th sub module, you will feel really comfortable and at the same time feel the power of lightning which will definitely inspire you to explore the unexplored world.Let’s start discussing each sub module.Sub Module 1: Getting Started with Lightning Components -This is the first sub module which will give you an overview of Lightning Components. By the end of this module you will understand below important concepts -What is all about Lightning Component Framework?Difference between Lightning and VisualforceWhat are the different places where you can use the Lightning Component framework?This sub module mainly tells you how you can go for component based development. Google is having Polymer, Facebook is having React and now Salesforce is also having Lightning Framework – Component based development.After completing the challenge, you can earn 100 points.Sub Module 2: Creating Components -This is the module where you will get familiar with creating lightning components, adding...

Read More

Salesforce Deployment Guide using Ant Migration Tool

In Salesforce, we have three different ways by which we can perform the deployment activities. They are -Change Sets – This is available from Salesforce.com site.By using “Deploy to force.com server” option in Eclipse.Using Java based tool – ANT.In this post, I will provide a complete deployment guide using Ant Migration Tool.Before I start, let me tell you the prerequisite for doing deployment using Ant Migration Tool.Requirement – Java: You should have java installed in your machine. To verify whether you have java installed, do the below steps -Open a command promptAt the prompt, type java -version. You should see something like below which indicates your installed java versionRequirement – Ant: You should have ant installed in your machine. To install ant, do the below steps -Download ant from http://ant.apache.org/bindownload.cgiSet environment variable “ANT_HOME” which should be the path of your installation. Add the bin folder to your path as well like %ANT_HOME%/binVerify by issuing the command ant -version from command prompt. You should see something like below which indicates your installed ant version.Once you have configured Java and Ant successfully into your machine, it’s time to download the Force.com Migration Tool. You can download the same by logging into your Org and then Setup | Develop | Tools and then click Force.com Migration Tool. Once downloaded, extract the zip file and copy ant-salesforce.jar file to the lib directory of your ANT...

Read More

Use Case 3 – WebSphere Cast Iron Integration – MySQL and Salesforce.com

Preface – This post is part of “WebSphere Cast Iron Cloud Integration with Salesforce.com” series.Today I will post how you can use WebSphere Cast Iron for integrating MySQL with Salesforce. Toady, in this example, I will fetch records from MySQL Table and then create the Salesforce object based on that record. So READY, STEADY and GO!!Note: I have used http://www.freemysqlhosting.net/ for creating free MySQL Database.Use Case:Below is the object structure -MySQL table looks like  – Implementation:Before we start implementing the above requirement, let’s create the Endpoints first.Endpoint – FTP:Endpoint – Salesforce:So all set. Now we will configure the integration by putting activities inside the Orchestration.Activity# 1: Database – Get Inserted Rows:In this activity, I will fetch the inserted rows from the database. Below are the configuration details -Activity# 2: Add If – Else Condition:The requirement is – if the Airport Name is blank, then terminate the process, else do an upsert into Salesforce.comThe configuration is displayed below -Activity# 3: Salesforce Upsert Objects:Below are the configuration details for this step – We are done. The final Orchestration looks like -Test the Integration -It’s time to test the configuration. First we need to start the orchestration and we can do that from Orchestration | Start Orchestration.After 5 seconds, if we see our Salesforce Airport object, we will be able to see that two records being created as shown below -COOL!!!If you follow the steps mentioned in this...

Read More

Use Case 2 – WebSphere Cast Iron Cloud Integration – Fetch CSV File from FTP Server and Insert Data into Salesforce.com

Preface – This post is part of “WebSphere Cast Iron Cloud Integration with Salesforce.com” series.Today I will post how you can use WebSphere Cast Iron for integrating FTP with Salesforce. Toady, in this example, I will fetch a CSV file present in a FTP server, read that file and then create the Salesforce object based on that record. Finally I will send the response also. So let’s not waste time here and get straight into the business.Use Case:Below is the object structure -Below is the CSV File(All_Airports.csv) I would like to read and load from FTP server.Once done, the final requirement is to create Salesforce records based on the data present in the CSV file.Implementation:Before we start implementing the above requirement, let’s create the Endpoints first.Endpoint – FTP:Endpoint – Salesforce:Endpoint – HTTP:Create a default HTTP endpoint with port number 80.Now we will create the Flat File Schema as shown below. This flat file schema will be used to read to CSV file present in the FTP server.So all set. Now we will configure the integration by putting activities inside the Orchestration.Activity# 1: HTTP Receive Request:Below you will find all the configuration details related to Receive Request activity.Activity# 2: FTP Get File: This activity will fetch the CSV file from the FTP Server. The configuration of this activity is displayed below -Activity# 3: Transform Read Flat File:Activity# 4: Salesforce.com Create Objects:In this...

Read More

“Bulkify Your Code” – Another Example with Use Case

This post is the continuation of my previous post”Bulkify Your Code” – Explanation of Salesforce’ Governor Limit with Use CaseUse Case -I have two custom objects (Airport__c and Country__c). Below screenshot will give you field details.My requirement is to make sure when I am inserting an Airport record, I need to check whether the country mentioned in the record is already present in the Country object, if not, then create a new Country record with name same as mentioned in the Airport’s Country field provided that Aiport is operational i.e. Operational__c == true.Solution -Initially it may look like the requirement is very easy to implement. But we need to keep in mind the Salesforce’s Governor Limit.If we go ahead with the approach of iterating over each new Airport record and then do a query against Country object to check whether that country is already there in the system, we will quickly hit Salesforce’s Governor Limit – “Total number of SOQL Issued – 100 (Synchronized) and 200 (Asynchronized)”.So we need to make sure that our code is efficient. Below is the optimized trigger which can handle the requirement and at the same time will make sure that we will not hit by Governor limit.trigger AirportTrigger on Airport__c (after insert) { List<Country__c> allCountries = new List<Country__c>(); List<String> allCountryNames = new List<String>(); //Fetch all Country Name and put it into a list...

Read More

Archives