0

I am running Data Loader via command line every night to upsert records from a third party generated CSV (using a Windows Scheduled Task), and am trying to figure out the best way to keep track (in Salesforce) of the last time a record was synched via the Data Loader process. The overall goal is to set up a time trigger to flag records that haven't been updated via Data Loader in 2 days (which means they have been deleted from the third party system), so I can set some fields on the record.

Originally I was thinking about using the LastModifiedDate, but the potential for a user to edit the record would mess that up. From looking at the documentation, I don't see a good way to automatically set a custom field to the current timestamp via Data Loader, but I'm hoping someone else has run into a similar use case.

1
  • As an alternative to the Salesforce Data Loader, take a look at the Jitterbit Data Loader. It is free and you can do things like assign a date value of Now(). It also has a built in scheduler so you don't have to deal with the windows scheduler. Commented Jan 24, 2013 at 4:11

1 Answer 1

1

Create a custom datetime field Last Sync Date that will be hidden from your users (or at least readonly if they need to see it in reports etc) + a workflow rule.

Workflow field update value to populate : NOW()

Condition: experiment a bit, something like

$Profile.Name = 'System Administrator' &&
CONTAINS($User.Username,'[email protected]') &&
(ISNEW() || ISCHANGED(FieldThatSurelyChanges__c))

should be a good start. Drop the last line if it's an overkill, CONTAINS is there to make sure it will work in sandboxes. If you don't really want to base it on username/role/profile - add a checkbox to User object or something.

2
  • Ah, that makes sense...isolating changes purely to the login running Data Loader. Commented Jan 23, 2013 at 19:25
  • Well, you say that now, no idea how many more integrations will be added to the system ;) Clearly defines when it was "system updated", you have it reliably on SF side and not on say Lead generating Java app, easy to disable if you'd need that for whatever reason and surely beats guessing current time & timezone of the user ;)
    – eyescream
    Commented Jan 23, 2013 at 19:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .