You need to sign in to do that
Don't have an account?
BOFH
Update multiple fiels in Account
Hi all--
I'm attempting to update the Account Number, and two custom fields under Accounts using the partner WSDL, C#.net, and the SOAP API. Anytime I do multiple fields nothing happens, but the program returns success. If I only do one field at a time, it updates that field without a problem and also returns success. Does anyone have any insight as to why this is happening? Does SalesForce only let you update one field at a time?
Thanks.
I'm attempting to update the Account Number, and two custom fields under Accounts using the partner WSDL, C#.net, and the SOAP API. Anytime I do multiple fields nothing happens, but the program returns success. If I only do one field at a time, it updates that field without a problem and also returns success. Does anyone have any insight as to why this is happening? Does SalesForce only let you update one field at a time?
Thanks.
{
updateRec.Id = oraWork.returnValues("id", 0); //gets the id of the record to update
updateRec.Any = new System.Xml.XmlElement[] { this.GetNewXmlElement("AccountNumber", oraWork.returnValues("orgid", 0)) }; //value is in a different class, oraWork.returnValues returns a string
UpdateRec.Any = new System.Xml.XmlElement[] { this.GetNewXmlElement("Primary_On_line_Account_Password__C", oraWork.returnValues("onlineaccountpassword", 0)) };//value is in a different class, oraWork.returnValues returns a string
updateRec.Any = new System.Xml.XmlElement[] { this.GetNewXmlElement("Primary_On_line_Account_Name__c", oraWork.returnValues("onlineaccountname", 0)) };//value is in a different class, oraWork.returnValues returns a string
updateRec.type = "Account";
SaveResult[] sr = binding.update(new sObject[] { updateRec });
for (int j = 0; j < sr.Length; j++)
{
if (sr[j].success)
{
Console.WriteLine("Success");
updateSuccess++;
}
else
{
Console.WriteLine("Fail");
updateFail++;
}
}
}
I am able to do the ID field and any of the other fields if I do them one at a time. I am sure the names are correct. When I try to run this code as is, nothing happens and it returns success. All three of the fields that I am updating are Text fields, and the value going into them, does not exceed the size that was placed on the field in SalesForce. If you need anything else, let me know.
Thanks.
I am not sure how you're currently appending elements to your static? doc, but you may need to use ImportNode instead of AppendChild.
I suspect you may be creating a new instance of an XmlDocument each time you call getNewXmlElement.
string a = "1"
a = "2"
a = "3"
Console.WriteLine(a)
and your wondering why it only prints 3.