What
I am trying to use Dataloader CLI to export Contacts created or modified since the process ran the last time.
The process runs properly, but it always retrieves the same records, and I want it to extract only the ones that have been modified (or created) since this process ran the last time.
Examples
This is how I run the process:
C:\Program Files (x86)\salesforce.com\Data Loader\bin>process.bat
"C:\dataloadercli" contact-extract
This is part of the output message shown when I run the process:
Rate: 3.600.000 records per hour. Estimated time to complete: 0
minutes and 0 seconds. There are 9 successes and 0 errors. 2015-05-29
08:13:14,434 INFO [contact-extract] progress.NihilistProgressAdapter
doneSuccess (NihilistProgressAdapter.java:63) – The operation has
fully complet ed. There were 9 successful extractions and 0 errors.
My process-conf.xml is like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="contact-extract"
class="com.salesforce.dataloader.process.ProcessRunner"
singleton="false">
<description>Descarga los contactos</description>
<property name="name" value="contact-extract"/>
<property name="configOverrideMap">
<map>
<entry key="sfdc.debugMessages" value="false"/>
<entry key="sfdc.debugMessagesFile" value="c:\\salesforce\\logs\\sfdcSoapTrace.log"/>
<entry key="sfdc.endpoint" value="https://test.salesforce.com"/>
<entry key="sfdc.username" value="xxxxx@xxxx"/>
<entry key="sfdc.password" value="xxxxxxx"/>
<entry key="process.encryptionKeyFile" value="c:\\dataloadercli\\key.txt"/>
<entry key="sfdc.timeoutSecs" value="600"/>
<entry key="sfdc.loadBatchSize" value="200"/>
<entry key="sfdc.extractionRequestSize" value="500"/>
<entry key="sfdc.extractionSOQL" value="select ID__c, MobilePhone, Birthdate FROM Contact WHERE ID__c != NULL"/>
<entry key="process.operation" value="extract"/>
<entry key="process.mappingFile" value="c:\\dataloadercli\\mappings\\contact-extract-map.sdl"/>
<entry key="sfdc.entity" value="Contact"/>
<entry key="dataAccess.type" value="csvWrite"/>
<entry key="dataAccess.name" value="c:\\dataloadercli\\desdeSalesforce\contact-extract.csv"/>
<entry key="process.useEuropeanDates" value="true"/>
<entry key="dataAccess.readUTF8" value="true"/>
<entry key="dataAccess.writeUTF8" value="true"/>
<entry key="process.initialLastRunDate" value="2005-12-01T00:00:00.000-0800"/>
</map>
</property>
</bean>
</beans>
Questions
Any idea about how can I do this??
Thanks!
Best Answer
There is no automatic solution for Apex CLI out of the box where you can use the process.lastRunDate from the properties file. However you can set a date filter like below which will limit the rows returned. The first example is where you hardcode a set datetime and the second example you can use a datetime function that is part of the SOQL.
Example (Pull everythng modified after midnight on August 1, 2015) select ID__c, MobilePhone, Birthdate FROM Contact WHERE ID__c != NULL AND LastModifiedDate > 2015-08-01T00:00:00.000Z
Example: (Pull Everything modified in the past 3 days) select ID__c, MobilePhone, Birthdate FROM Contact WHERE ID__c != NULL AND LastModifiedDate = LAST_N_DAYS:3