Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  Daniel Hoechst Jan 24 '13 at 4:11
add comment

1 Answer

up vote 1 down vote accepted

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,'integration.user@example.com') &&
(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.

share|improve this answer
    
Ah, that makes sense...isolating changes purely to the login running Data Loader. –  Michael Welburn Jan 23 '13 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 Jan 23 '13 at 19:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.