function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
garybgaryb 

Auto-numbers and multiple data loader sessions

Hopefully an easy one...

 

If I use Dataloader to insert new records and the object I'm inserting has an autonumber field, is there Salesforce magic to prevent an autonumber being used twice in the separate sessions? Something like:

 

1. Session A begins first batch of insert

2. Session B begins first batch ofinsert

3 .Session A finishes first batch ofinsert

4 .Session B finishes first batch ofinsert

 

Between 2 and 3, will an autonumber used in Session A ever occur in Session B?

 

Thanks in advance...

aalbertaalbert

By defining a field as an Autonumber it is guaranteed to be unique. Your data load will be fine.

garybgaryb

Thanks for the quick response! Peeling away the next layer of the onion....

 

I have a trigger on the object with the autonumber on it. This copies some information across to another object, including the autonumber. The field to which it is copied is marked as unique.

 

I'm getting errors when running concurrent dataloader sessions - the error is that I'm trying to create a secondary object with a duplicate value. I'm now wondering if, in my original example, in the triggers the autonumbers clash but before the objects are written to the database, the clash is resolved...

 

Clutching at straws maybe ;) I'm going to raise a case with Salesforce as well to get their opinion.

aalbertaalbert

I recommend adding System.Debug statements and using the addError() method in your apex logic to get better debugging information to exactly what is going on.

garybgaryb

Massive apologies, the data load that absoloutely couldn't be the problem (and therefore I didn't check...) was to blame. Sorry for the unnecessary thread :(