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
MAvdiMAvdi 

So how to work with autonumbers when upserting?

I see that many people have the same issue I got.
I've got an object which the external ID is a autonumber I assigned. However when I add the row it doesnt do so, and doesnt give me any error message
Lets say I have a field for relationships of ISBN code and Author with a Author number
So 3 columns
Autonumber===ISBN====Author

and I want to add these values

sobject.Name="null" //this is what I used to to with mysql
sobject.ISBN__c="1234567891234"
sobject.Author__c="Jimmy"
then upsert.
myconn.upsert("Name",[sobject],callback);

well this code doesnt work, How can we upsert values in tables with autonumber as external IDs?
i tried assigning "null", "Null" and not assigning anything, none which worked


Message Edited by MAvdi on 05-15-2008 05:29 PM
MAvdiMAvdi
Ok I found it out,
First off you shouldnt choose the "Name" field as an external ID. I dont know why, but its like that
Create your own external ID with autonumber generator. lets say you names it "Ex_ID"
and you're thinking you can access it saying "Ex_ID__c"... WRONG

you shoud access it with "ID" identifier
so your upsert command will be upsert( "ID", mysobjects, callback);
dont assign any value to Ex_ID ro ID when upserting, the system will generate numbers automatically

Just wanted to share it, maybe some googler will run into it.