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.
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.
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.
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.
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.
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.
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.
If we want to use Ant Migration tool to fetch Salesforce Organization metadata info or to deploy some changes to Salesforce, we need to create “package.xml” manually or take help of eclipse. wildcard character (*) doesnt work with some components like report, emailtemplate, dashboard and document. Package.xml must needs to have folder name and files inside folder name. After getting package.xml from eclipse, what if some folder is added into Organization ? We need to update “package.xml” again with help of eclipse or do it manually. Therefore I wanted to automate generation of package.xml completely and came up with this article and below workaround.
I would be using Ant to generate “package.xml” with below steps
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
Following are basic steps for CLI Dataloader :
Download and install DataLoader
Generate Secret key file
Generate Password on basis of Secret key generated
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
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
This directory contains two utility batch file : “encrypt.bat” and “process.bat”
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.