I want to extract data from Salesforce from command line. I can use data loader by creating process-config file but I need to automate this process using windows batch file. For example, I have 5 different objects in SF from where I need to pull data regularly. The data pull from those 5 objects will always be from a several orgs (not a single org). Is there a way to extract data from salesforce for those 5 objects without having to create a map file. The reason for not creating map file is that the 5 objects may differ from org to org. Hard coding the SOQL will not work for my requirement. Any suggestions as to how I can achieve this in Salesforce?
I had a similar project for a client. I used DataLoader + Batch script file to automate extract / import data from/to Salesforce.
Look a this amazing tutorial to Setting up Automated DataLoader.
At the end you'll be able to launch a script (.bat file). Then you can create a Scheduled Task on your server to automate all your processes.
I remember that i had to hard code my SOQL query in the process-conf.xml and my map files. I used Node.js to run some script to read/write DataLoader process-conf.xml file and to create some map file etc... (Another exemple : Creating log files...)
For your MAP FILES :
- EXTRACT : It's not mandatory to use a map file (Your .csv header will be filed by your fields API's names)
- IMPORT : If you specify field API NAME in the header of your .csv file, Salesforce will automatically map your fields with SalesForce.
I hope it will help you !