Dynamically remove XML content from metadata before Salesforce deployment using xmlTask – Video

Example – automatically remove listview before deployment

Many post about deployment using ANT has been posted on this blog like auto backup complete Salesforce instance daily, upload Salesforce data on FTP Server, auto generate package.xml, continuous integration and so on.

While implementing real Continuous integration in Salesforce, we need to perform various adjustments in metadata before deploying it to build server or production instance, many automated scripts (automation) are needed. If you need to change ANT scripts or metadata frequently, then it means continuous integration or deployment process in your Salesforce project is not yet fully matured.

There could be multiple situation where we don’t want some component to be deployed on production and example of one of them is List view Continue reading “Dynamically remove XML content from metadata before Salesforce deployment using xmlTask – Video”

Delete Components using Ant Migration tool – Video

This video tutorial shows that how we can delete components like Apex class, trigger from Salesforce using ANT migration tool.

I have posted multiple basic and advance articles about using ANT or ANT migration tool with Salesforce. Some of most visited articles are :

Going through multiple comments, I decided to create this 5 minute video tutorial to demonstrate, how we can use DestructiveChanges.xml in Ant migration tool to delete components.

As known already, we cannot simply delete components from Salesforce production using changeset. Apex classes, triggers etc cannot be deleted manually as well.

subscribe to Youtube channel, to get notifications about new Salesforce videos.

 

Creating custom ANT plugin or Task in Java

Author posted by Jitendra on Posted on under category Categories JAVA and tagged as Tags with 1 Comment on Creating custom ANT plugin or Task in Java

Tutorial to create custom Task in ANT with complete source code

ANT is very powerful and one of the most used tool in Java and other platforms like Salesforce. In Salesforce, ANT is officially used to deploy changes on instances using Metadata API. It is also integral part of Continuous Integration. Even though, there are hundreds of libraries and ANT Tasks are available to use, however there are many scenarios where we need to create our own custom Task.

I am using many custom ANT tasks in my projects and its very easy to create. For example, I have created automated data load process with custom ANT task, which is almost as powerful as of any paid ETL tool.

In this blog post, We will go through creation of very simple ANT plugin. We will create a custom ANT Task with nested tags , attributes and then print it on console. It shows that, we can read attribute passed in build.xml. if we can read attribute, then writing any custom logic is not a big deal. Continue reading “Creating custom ANT plugin or Task in Java”

Using Dataloader and ANT to backup Salesforce data on FTP or SFTP server – Video

Tutorial on how to use command line dataloader to save exported Salesforce backup file on FTP or SFTP server

We will be using command line dataloader from Salesforce and ANT script to extract data from Salesforce and backup on FTP server. I would recommend to go through this article first to get familiar with basics of commandline dataloader and followed by this article to get some insight that how we can use ANT with dataloader.

There can be hundreds of use cases where we need to backup data from salesforce and we have thousands of options. We can use Jitterbit, Mulesoft, Dataloader.io or some big ETL tools like BOOMI or informatica. However sometimes clients are not willing to pay hefty  amount on licensing cost of ETL tools and I love open source. In this article, we will be using open source solution to very common problem of backing up data on FTP server.

Complete code is available on my github account as well in case you need it.

Use Dataloader and ANT to back CSV file on FTP Server
Use Dataloader and ANT to back CSV file on FTP Server

Considering you know how to use command line dataloader, first challenge would be how to get it worked using ANT. Below code snippet show how we can create ANT macro to invoke dataloader to extract data. Continue reading “Using Dataloader and ANT to backup Salesforce data on FTP or SFTP server – Video”

Continuous integration in Salesforce Using Jenkins and Git | Video Tutorial

As your Salesforce Organization undergoes heavy customization and frequent builds, moving changes from one Sandbox to other sandboxes starts taking longer time and effort. Also, in normal Salesforce project, there are chances that you will have minimum three sandboxes likely Developer Sandbox, QA Sandbox and UAT Sandbox. After some time you will be in need of some solution which can reduce your effort.

Almost 5 years back, when I was working on .net along with Salesforce, I posted article on Continuous Integration of ASP.net and subversion as a code management with MSBuild on code project.

This time its Salesforce using Jenkins. In this article I will walk through solution of above problem using Jenkins. Don’t forget to watch Video at end of this article, where I provided demo of everything explained in this article.

Prerequisite Software:

  1. ANT
  2. Salesforce Migration Tool
  3. Git
  4. Eclipse or PuTTYgen to generate SSH key

I am assuming you already know about below concepts:

  1. How to use Git with Salesforce
  2. Using ANT migration tool in Salesforce
  3. Generating SSH key
  4. Automated Daily Backup of Salesforce Using ANT Migration Tool and GIT (Optional)

I will suggest to get familiar with first three topics before jumping to Continuous Integration.

There are two ways to start working with Jenkins

  1. Install Jenkins on your local system
  2. Use Cloudbees online

Below diagram shows complete flow of Continuous Integration we are going to setup in this article.

Continuous integration in Salesforce Using Jenkins and Git
Continuous integration in Salesforce Using Jenkins and Git (Bit Bucket)

For this tutorial, I will install Jenkins on my local system. To install it, Navigate to Jenkins homepage and download installer. Continue reading “Continuous integration in Salesforce Using Jenkins and Git | Video Tutorial”

Automate Command Line Dataloader using ANT with Dynamic arguments and SOQL query

As we know, there are multiple ways to load data inside Salesforce like using Workbench, Jitterbit, API etc… Salesforce also provides standard tool to load data into Salesforce using DataLoader. Dataloader by default supports User Interface or Command Line interface. Most of us already know that User interface based Dataloader needs manual interaction by end user. However if you want to automate data related operations, better choice would be Command Line Data Loader. Assuming you already have basic knowledge about how CLI Data loader works, I will go more advance in this article.

Automate Command Line Data Loader
Automate Command Line Data Loader

Following are basic steps for CLI Dataloader :

  1. Download and install DataLoader
  2. Generate Secret key file
  3. Generate Password on basis of Secret key generated
  4. Create “Process-conf.xml” (here is the problem)
  5. Create field mapping (sdl) file if required
  6. Execute Data loader from Command line

Continue reading “Automate Command Line Dataloader using ANT with Dynamic arguments and SOQL query”

Automated Daily Backup of Salesforce Using ANT Migration Tool and GIT

In few previous articles, I have talked about how to use “ANT Migration tool in Salesforce” and “How to Use EGit plugin in Eclipse to work with Git“. So to make this article short, I assume that you are already familiar with ANT Migration tool provided by Salesforce and Git.

During project development life cycle it is very essential to backup your code and Configurations daily. However sometimes developers forgot to commit changes in Git, may be  because of workload. It may create an issue if someone wants to check back history of code for that duration, there will be no use of having code repository in place if it cant help us to get out of problem.

In this article, I will move one step further and explain how to setup automated script which will run on your System startup and commit backup of your Salesforce organization into local Git repository without any manual interference.

Salesforce Automated Script for Data Backup Using CommandLine
Salesforce Automated Script for Data Backup Using CommandLine

Continue reading “Automated Daily Backup of Salesforce Using ANT Migration Tool and GIT”

Command line dataloader in Salesforce – Solve Common errors

I had this article in my list for long time and today i got chance to share with you all. Data Loader is great native tool provide by the Salesforce to insert, upsert, update, export and delete data. Standard Data Loader wizard needs interaction however there are many scenarios where we need to perform these data loading tasks repeatedly like every night 1:00 AM (Nightly Services) or something. So, for these situations we can use standard data loader tool from Command line.

In this article, i will explain in detail on how to use Data Loader from command line.

The most important part of setting up Command line Data loader is to generate the encrypted password using utility provided by the Data Loader.

Commandline Data Loader tools
Commandline Data Loader tools

This directory contains two utility batch file : “encrypt.bat” and “process.bat” Continue reading “Command line dataloader in Salesforce – Solve Common errors”

Complete Salesforce Deployment Guide using Ant Migration Tool

Step by Step tutorial of Salesforce Migration using ANT tool with Proxy settings and retrieving content from Salesforce Organization

Following are the three ways to Migrate code, objects, schema etc… from organization to another :

  1. Change sets (From Salesforce site)
  2. Eclipse (Using “Deploy to force.com server” option in Eclipse)
  3. ANT (Java based tool)

We are going to discuss the ANT based migration, step by step:

Prerequisite:
JDK 1.5 or above

Step 1:
Download ANT distribution from – “http://ant.apache.org/bindownload.cgi

Step 2:
Set Environment variable “ANT_HOME“. The path should be of parent folder of “bin”. Also add the “bin” folder to your path.

Step 3:
Check whether ANT is installed or not properly by running command “ant -version“. It might be possible that you receive message something like “unable to find tools.jar“. You can copy this jar from “JDK_HOME/lib/tools.jar” to “JRE/lib” folder.

Continue reading “Complete Salesforce Deployment Guide using Ant Migration Tool”