function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JJoshJLJJoshJL 

Lets Try that again... binding.QueryOptionsValue

Dont know what just happened, but let me try and repost...

I have a wierd error that i am getting. I am using proper syntax (i think) when trying to run a query on salesforce data. When it gets to the binding.queryoptionsvalue = ... line, it returns with the following error

"Object refrence not set to the instance of an object"

I am loggin in,  and am using a code snippet i have used before... any hep is greatly appreciated.

Environment ( 5.0 API, VB.net)

Thanks in advance

Josh

 

CODE SNIPET

login()

Dim ownerName As String = owner

Dim Soql As String = "select Id from user where email = '" & ownerName & "'"

Dim idr As Salesforce.QueryResult = Nothing

binding.QueryOptionsValue = New Salesforce.QueryOptions <---------------- Fails Here

idr = binding.query(Soql)

Dim id_i As Integer = 0

If idr.size > 0 Then

For id_i = 0 To idr.records.GetUpperBound(0)

Dim a_i As Salesforce.User = CType(idr.records(id_i), Salesforce.User)

ownid = a_i.Id

Next

End If

Ron HessRon Hess

working from memory here,

queryOptions is set in the soap header , not a seperate object

so, in VB you may want to try :

Salesforce.SetSoapHeader section, name, value

or -->  Salesforce.SetSoapHeader("QueryOptions", "batchSize", "1")

for a normal query this is NOT required because the toolkit handles all the query & query more stuff, so even the above may not work as you expect.

remember the officetoolkit is not exactly the same as the API, use the object Browser in VB / VBA to see what objects exist, Salesforce.QueryOptions  does not.

 

JJoshJLJJoshJL

The problem is, i have used that syntax for over a year and never had any problems. Could there have been a change i the summer re;ease that would cause this?

 

Thanks

Josh

Ron HessRon Hess
yes, it could have changed, the most recent toolkit release to address an expiring cert may have removed this object.
SuperfellSuperfell
Are you using the office toolkit, or the Web Services support in VB.NET (it looks like that latter, but the other comments are based on the office toolkit)
JJoshJLJJoshJL
It is for the web services, not office
Ron HessRon Hess
my mistake, all my comments assumed you were using the office toolkit, just ignore those...
DevAngelDevAngel

Hey Josh,

Give me a little more background, did you recently change an endpoint, refresh the wsdl or anything like that?  Is you binding instantiated?  Are trying to multi thread?

JJoshJLJJoshJL

I grabbed the latest wsdl from our site. I ussualy do that everyime i write/rewrite a salesforce application. In terms of the initiating the binding everyhting that would normaly work is in the code in the first post. I ussualy dont have any issues. No multithreading realy takes place. Login() is in a seperate module where I keep my globals. Other than that, there is nothing strange about the process. In regards toi what i am trying to do, I am simply trying to retrieve the salesforce owner ID using their email... This should not be too difficult a task, but it wants to bang its head on a wall it seems. It is quite possible there is something external closing my login session, but other than that, I wouldnt know.

Thanks

Josh 

SuperfellSuperfell
The error can only imply that the binding variable is null. perhaps the local call is creating a local binding variable rather than populating the global one ?
JJoshJLJJoshJL

Makes senese... let me look at it a little further...

Thanks

Josh