You need to sign in to do that
Don't have an account?
Again Again
Problem with error trapping with Salesforce API Error object
Hi everyone,
We recently have updated our Enterprise WSDL to expose a newly added field from the SalesForce GUI. Once we updated the WSDL on a ASP.Net 2.0 application.We cannot use the following pattern to trap errors anymore.
Code:
Binding is defined in the partial class declaration of the page as the following: Private binding As sforce.SforceService and is later referenced in the following code in a function: Dim SaveResult() As sforce.SaveResult If hdContactID.Value <> "" Then Try If binding Is Nothing Then Response.Write("Binding nothing") Else Response.Write("Binding something: " & binding.Timeout.ToString) End If If contactrecords Is Nothing Then Response.Write("contactrecords nothing") Else Response.Write("<LI>" & contactrecords(0).Id) End If SaveResult = binding.update(contactrecords) Catch ex2 As Exception SqlHelper.ExecuteNonQuery(ConfigurationManager.AppSettings("connStrErrorLog"), "SF_WebAppLogsInsert", "Binding - update", ex2.Message.ToString, "EditContact.vb", "Binding.update", "", "", "Update Contact", -1) Response.Write("<font color=green><LI>Error!: " & ex2.ToString) Exit Sub End Try Dim upderr As sforce.Error If Not SaveResult Is Nothing Then upderr = SaveResult(0).errors(0) Else Exit Sub End If
The ASP.Net 2.0 error is occuring at upderr = SaveResult(0).errors(0) with an 'Object reference not set to an instance of an object' error.
We have used this exact same code without issue before the change to the most recent Enterprise WSDL change.
Does anyone have an idea as to why this error is occuring now?
Thanks!
Again Again
Sorry for the triple post... Still getting used to this all.
DevAngel
You should always be checking if saveResult(0).success == true, and it not, then go grab the error.