You need to sign in to do that
Don't have an account?
Classic ASP: Error Updating records
It seems I have followed the instructions I found in the forum, but sforce returns me an error when I call the update method. My code is this one:
'begin code
Set SforceApi = server.CreateObject("SForceOfficeToolkit.SForceSession")
if SforceApi.Login(login,password,false) then
strSQL="Select AccountNumber, Description, Id, Name from Account where Id='fakedid'"
set queryResults = SforceApi.Query(strSQL, False)
for each sobj in queryResults
sobj.Item("Description").Value = "testing"
Response.Write sobj.Item("Id").Value &","&sobj.Item("Name").Value &","&sobj.Item("AccountNumber").Value &","& sobj.Item("Description").Value
SforceApi.Update queryResults,false 'here fails
next
end if
'end code
the error I get is this one:
error '800706be'
it works properly, retrieving a record, accessing its properties, changing them (in memory) but fails when I try to upload that record on salesforce.
Can anyone help me?
thanx
Your query is trying to find an account with id = "fakedid" which should not return results, but apparently it is?
Then your trying to update the queryresults object. The method takes an array of objects....
You might want to msgbox the errormessage, is most times more useful.
you must use the enumeration to construct an array before passing to Update.
You can see the data types using the Object Browser in most microsoft languages.
so a function like this may help convert a query result set into an array of sobjects which can then be passed to Update()
Public Function SObjectArray(ByVal qr As QueryResultSet3) As Object
Dim sa() As SObject3
ReDim sa(2000)
For Each s In qr
Set sa(x) = s
x = x + 1
Next s
ReDim Preserve sa(x - 1)
SObjectArray= sa
end function
this is VBA, but should work in basic also