You need to sign in to do that
Don't have an account?

I send 200 object in upsert but get back 100 objects in upsertresult
HI All,
I am seeing a weired issue with upsert...!
I have a program with multiple threads trying to upsert(). Each thread sends 200 objects using upsert().
And many of them get back only 100 objects in upsertResult[]. Very of them get back 200 objects.
Please advice what could be happening here.
Thanks in advance.
Regards,
Ramana Maddikunta
How stupid I am!!!
Simon, sorry for wasting your time. But may be my tiered eyes overlooked a line of code that I removed from the tailored piece of code I sent you (highlighted in RED below). And the default value for ErrorThreshold is 100. May be I need some rest now..!! It had been a long day about 19-20 hours..!! huh!
int objIndex = 0;
int successIndex = 0;
int errorIndex = 0;
UpsertResult[] upsertRes = m_binding.upsert(externalIDFieldName, sfdcObjectArray);
System.out.println("UpsertResult size " + upsertRes.length);
for (UpsertResult result : upsertRes)
{
objIndex++;
if (result.isSuccess())
{
successIndex++;
System.out.println("Object upserted successfully);
}
else
{
errorIndex++;
String errorMessage = result.getErrors(0).getMessage();
System.out.println("Error corresponding to the object " + errorIndex + "::"+ errorMessage);
if(errorIndex > ErrorThreshold) break;
}
}
System.out.println( "Executed Batch upload for (" + successIndex + "+" + errorIndex + ")" + (successIndex + errorIndex) + " records");
All Answers
Simon,
Thanks for the quick response. No, I am using the same stub for all the threads.
Regards,
Ramana Maddikunta
Simon,
Thanks a lot for the quick advice. I will make appropriate changes and see if that does the trick.
Regards,
Ramana Maddikunta
Simon,
Through I made every thread use its own stub instance, the same issue persists.
Please advice what else could be going on.
Regards,
Ramana Maddikunta
Simon,
Each thread has its own instance of sfdcObjectArray, so NO chance of overstepping. The size of the sfdcObjectArray before the call is 200 in each of them. And interestingly, the usertResult size immediately after the upsert call is 200, but when I iterate through the upsertResult array, then the last statement in my code sample, gives 100 records..!!
Not sure if for each is the spoilter here.
Regards,
Ramana Maddikunta
Yes Simon,
I run into the same problem, even with a single thread.
Thanks,
Ramana Maddikunta
How stupid I am!!!
Simon, sorry for wasting your time. But may be my tiered eyes overlooked a line of code that I removed from the tailored piece of code I sent you (highlighted in RED below). And the default value for ErrorThreshold is 100. May be I need some rest now..!! It had been a long day about 19-20 hours..!! huh!
int objIndex = 0;
int successIndex = 0;
int errorIndex = 0;
UpsertResult[] upsertRes = m_binding.upsert(externalIDFieldName, sfdcObjectArray);
System.out.println("UpsertResult size " + upsertRes.length);
for (UpsertResult result : upsertRes)
{
objIndex++;
if (result.isSuccess())
{
successIndex++;
System.out.println("Object upserted successfully);
}
else
{
errorIndex++;
String errorMessage = result.getErrors(0).getMessage();
System.out.println("Error corresponding to the object " + errorIndex + "::"+ errorMessage);
if(errorIndex > ErrorThreshold) break;
}
}
System.out.println( "Executed Batch upload for (" + successIndex + "+" + errorIndex + ")" + (successIndex + errorIndex) + " records");