You need to sign in to do that
Don't have an account?
Error with Update statement in C# .NET
I am getting this error when I try to run the code below. Please help.
Error:
System.Web.Services.Protocols.SoapHeaderException was unhandled
Message="A duplicate value was specified for field 'Id' in object 'Opportunity', duplicate value '00650000008ov0VAAQ' prior value '00650000008ov0VAAQ'"
_______________________________________________________________________________
Code:
sObject[] myOppties;
myOppties = sfdc.retrieve("Id, AccountId", "Opportunity", new String[] { "00650000008ov0VAAQ", "00650000008mpS4AAI", "00650000008m20QAAQ" });
for (int i = 0; i < myOppties.Length;i++)
{
if (myOppties[i].Any[0].InnerText == "00650000008m20QAAQ")
{
myOppties[i].Any[1].InnerText = "0015000000IRt4nAAD";
}
System.Console.WriteLine(myOppties[i].Any[0].InnerText + " " + myOppties[i].Any[1].InnerText);
}
SaveResult[] mySaveResult = sfdc.update(myOppties);
Hi aalazzani,
When you paste ur code next time put in a SRC (CODE) box which you can find on the Message body tool bar. Otherwise its pretty hard to find the reply button link to your posts :smileytongue:
The System.Web.Services.Protocols.SoapException is thrown when you have an invalid username or password! Check your username and password.
Ta
Zitizon X
Sorry, this is the first time I am using the discussion board. Here is the code:
Code:
I'm new to Apex myself and received this same error message just yesterday. I found that you cannot include the Id field in the retrieve call. You get the Id field value automatically in the .Id member of the sobject array returned from the retrieve call. Use the .Id member and not .Any[0].InnerText. The .Id member of the sobject object is used to determine which record to update.
Remove the Id field from your retrieve statement and evaluate .Id member like this.
Code:
Good luck!