• JJoshJL
  • NEWBIE
  • 0 Points
  • Member since 2004

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 14
    Replies

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

Quick Question to All. I am pretty sure I know what is causing this, but I want to make sure. I have a script that automagically checks our sales force data once a day. Every so often I will get the following two errors.

The operation has timed-out.:7/9/2005 8:37:37 AM
Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.:7/11/2005 2:01:35 AM

Am I getting this error because my session has timed out? Or could something else possibly be the issue.

 

As a note, this happens randomly. It doesnt always happen at the same point. It also happens at various points within sub scripts.

 

Thanks

Josh

 

 

Greetings all, I have an extremely strange situation occurring that I cannot figure out what is going on. I have a piece of code that works beautifully on two differnat applications. I created a new application to streamline some of my daily functions, and once again needed this same code snippit. Anyway, I ported the same code over that I have used on several differant applications, works fine on those application, and on the new application, I get "Object refrence not set to an instance of an object". After doing a little digging, I am able to detirmine that it is dying on

binding.QueryOptionsValue = New Salesforce.QueryOptions

I am properly logging in so I do not believe that is the issue, though normally, that would be the case. I know the Login script works because in order to access the application, you have to authenticate against salesforce. Furtheremore, another script in the same application that updates my assets works fine. The ONLY differance in the way the two scripts are called is that on the successfull application, it is single threaded application, on the faulty one the application is multithreaded. I dont see why this would be an issue though because the script is a public subroutine and runs (in theory) the same way. Also, all of the salesforce variable declarations are the same in both apps. It also uses the same WSDL. Any help is greatly appreciated.

Josh

API 5.0, VB.NET

I am having a problem that I can't seem to understand why it is occuring. I have a script that is attempting to manipulate about 6000 records. It requires 3 pieces of information from salesforce, each in a differant table. In any case, if I run a raw count gathering just the first peice of data, It will go through all 6000 records without any issues. However, When I add in the second and third queries to the equation, I get the invalid query locator error... The two subqueries will never return more than 1 result based on how the query is set up, so I cant be getting the query locator error from that. In anycase, any assistance will be greatly appreciated..

While bool

For b = 0 To qr.records.GetUpperBound(0)

....

code

....

If qr.done Then

bool = False

Else

qr = binding.queryMore(qr.queryLocator)

End If

 

 

API 5  VB.net environment

Cheers

Josh

Am I missing something. Everytime I try and do a make test on the Salesforce Module, almost every test fails. Ive checked all the packages it says is needed (and it was a lot) it just keep returning the same error :  ' 500 Can't locate object method "new" via package "LWP:rotocol::https::Socket"  ' : Ive got the latest LWP package installed, so that shouldnt be it. Im at a lose. I've spent most of the day trying to get this to install properly but to no success. Any help is welcome.

OS: Redhat

Thanks in advance

Josh

Hey All,  Just wanted to Post something for everyone that deals with handling stale logins. It hasn't ever seem to have a problem with batch updates, querying, or using the querymore function. Anyway, feel free to make changes to it as you see fit, but hopefully this will help a few people. Also, If you have a better way, feel free to post/critique this one.

VB.net, API 4.0

 

Dim relog as integer = 0

While true

****Do some Salesforce Stuff

relog = relog + 1

       If relog > 2499 Then

              loggedIn = False

              login()

              relog = 0

       End If

end while

Adjust the count Maximum  as is suited for your updates/queries,  2500 may be too large or small for  what you do. Also, it calls the standard Login script provided by the Sforce VB samples.  Anyway, Have fun

Josh

Hopefully this will be the last time I need to post for a while. In any case, having some difficulty with querymore. In my code, I can get it to work until I add in the following code.

updowner.Id = assetid

updowner.OwnerId = userid

conacc(0) = updowner

binding.update(conacc)

If I coment this one part out, the querymore option works without a problem, If I leave it in it dies with an invalid_query_locator error. Any help is appreciated as I am perplexed by this one..  API = 4.0    VB.net  Here is the section of code with a problem. Thanks in advance

Josh

While bContinue

 For b = 0 To qr.records.GetUpperBound(0)

 Dim l As salesforce.Assets__c = CType(qr.records(b), salesforce.Assets__c)

 assetid = l.Id

 accountid = l.Customer_Number__c

 soql2 = "select OwnerId from account where id = '" & accountid & "'"

 Try

  Dim qs As salesforce.QueryResult = Nothing

  binding.QueryOptionsValue = New salesforce.QueryOptions

  qs = binding.query(soql2)

  c = 0

  If qs.size > 0 Then

   For c = 0 To qs.records.GetUpperBound(0)

    Dim m As salesforce.Account = CType(qs.records(c), salesforce.Account)

    userid = m.OwnerId

   Next

  End If

  Catch ex As Exception

  MessageBox.Show(ex.Message)

 End Try

 Dim updowner As New salesforce.Assets__c

 Dim conacc(1) As salesforce.sObject

 updowner.Id = assetid

 updowner.OwnerId = userid

 conacc(0) = updowner

 binding.update(conacc)

 'MessageBox.Show(userid & " : " & userid)

 Console.WriteLine(b & ":" & l.Id & ":" & accountid & ":" & userid)

 Next

 If qr.done Then

 bContinue = False

 Else

 qr = binding.queryMore(qr.queryLocator)

 End If

End While

What is the easiest way to use or statments in your query. What I currently have does not seem to want to work right and returns a malformed query. Thanks in advance.

zipfind1 = "BillingPostalCode = '" & zip & "'"

soql1 = "and type != '" & typec & "' or type != '" & typem & "'"

soql2 = "select id from account where " & zipfind1 & soql1

 

Dim qr As salesforce.QueryResult = Nothing

binding.QueryOptionsValue = New salesforce.QueryOptions

qr = binding.query(soql2)

c = 0

If qr.size > 0 Then

Console.WriteLine("blah")

For c = 0 To qr.records.GetUpperBound(0)

Dim m As salesforce.Account = CType(qr.records(c), salesforce.Account)

id = m.Id

 

API 4.0

VB.net 2003

 

Thanks again

Josh

Next

End If

Greetings All

  Quick question. Having an issue with changing the account owner on one of our custom tabs. Simply put, I am trying to change the owner of an asset the same owner of the associated account. Im pulling the owner ID from the associated account without any issues, however, I'm having issues trying to use that same owner ID to change the asset owner. It's probably something simple Im missing, But I cant see it. Anyway, Any help is appreciated.

Thanks

 

Josh

API = 4.0

VB.NET

Dim updowner As New salesforce.Assets__c

Dim conacc(1) As salesforce.sObject

updowner.OwnerId = userid

conacc(0) = updowner

binding.update(conacc)

Hopefully an easy question...

Is there or will there be some comparible way to do a "select * from table" statement? I need to pull all of the fields and typing in each field name seems somewhat inefficient. I currently am using VB.net if anyone has a workaround for this. Also, API v 4.0.

 

Thanks in advance

Josh

Hello All,

     Getting a new message that I havent seen before. I have a Login sub that automates the login as well as keeps my connection from going stale. Normaly, how it works is that after  a set amount of time, it will logout and log back in so that I don't run into a session timeout error. In anycase, I set it to pop up the error messages as they com along and I get this error

 "client found response content type of ", but expected 'text/xml'." 

As a note, ive run programs with this script succesfully for several months without any issues. Are there any changes I should know about? or is this something differant. The login script is provided below. As you can see, it is the standard login script provided by the sample. Any help is appreciated. Thanks in advance...  

Josh

 

Public Sub login()

Dim un As String = "jlockhart@bbsjax.com"

Dim pw As String = "*******"

 

'//Provide feed back while we create the web service binding

Console.WriteLine("Creating the binding to the web service...")

Status.Text = "Creating the binding to the web service..."

 

'* Create the binding to the sforce servics

binding = New salesforce.SforceService

binding.Timeout = 60000

 

Console.WriteLine("LOGGING IN NOW....")

Status.Text = "Logging in now"

loginRes = binding.login(un, pw)

 

Console.WriteLine(vbCrLf & "The session id is: " & loginRes.sessionId)

Console.WriteLine(vbCrLf & "The new server url is: " & loginRes.serverUrl)

'//Change the binding to the new endpoint

binding.Url = loginRes.serverUrl

'//Create a new session header object and set the session id to that returned by the login

binding.SessionHeaderValue = New salesforce.SessionHeader

binding.SessionHeaderValue.sessionId = loginRes.sessionId

Debug.WriteLine(loginRes.sessionId)

loggedIn = True

End Sub

Newbie here again. I�ve managed to get my program to update to the DEV site, however, my production level code does not seem to update on Salesforce�s side. I do not get any errors when I run, and even get the final message I have built in saying X files written. I have generated a wsdl for our enterprise and have each of the needed fields referenced properly (I think). Any suggestions? Thanks in advance

 

Code:

 

SQL statements and login statements above this section

 

Try

Dim account1 As Enterprise.Assets__c

Dim account As Enterprise.Account

Dim accs(1) As Enterprise.sObject

account1 = New Enterprise.Assets__c

account = New Enterprise.Account

If accounts Is Nothing Then

account.AccountNumber = "0000000"

Else

account.AccountNumber = "000000" & (accounts.Length & 1)

End If

account1.Name = "test" 'r1("model")

account1.Type__c = "copier"

account1.Customer_Number__c = R1("CUSTOMER_NUMBER")

account1.Make__c = "sharp"

account1.Vendor__c = "ABS"

account1.Contract__c = "1ch"

account1.Model__c = "DR5020"

account1.OwnerId = "BBSJAX"

accs(0) = account1

binding.create(accs)

Catch ex As Exception

Console.WriteLine(vbCrLf & "Failed to create account, error message was: " & vbCrLf & ex.Message)

End Try

End If

 

Catch statements for me below here

Hey all,

Im getting an error that I cant seem to correct. I am trying to write a test query that will first iterate through a SQL table, and then, if there are no matches, add the new information to SForce. I've managed to correct all issues but this one. After I run the try statement that gets all the needed values, there is the statements

              

Dim sr() As SaveResult = binding.create(accs)

unfortunantly, (accs) comes back with the following error:

 

Value

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

Greetings all, I have an extremely strange situation occurring that I cannot figure out what is going on. I have a piece of code that works beautifully on two differnat applications. I created a new application to streamline some of my daily functions, and once again needed this same code snippit. Anyway, I ported the same code over that I have used on several differant applications, works fine on those application, and on the new application, I get "Object refrence not set to an instance of an object". After doing a little digging, I am able to detirmine that it is dying on

binding.QueryOptionsValue = New Salesforce.QueryOptions

I am properly logging in so I do not believe that is the issue, though normally, that would be the case. I know the Login script works because in order to access the application, you have to authenticate against salesforce. Furtheremore, another script in the same application that updates my assets works fine. The ONLY differance in the way the two scripts are called is that on the successfull application, it is single threaded application, on the faulty one the application is multithreaded. I dont see why this would be an issue though because the script is a public subroutine and runs (in theory) the same way. Also, all of the salesforce variable declarations are the same in both apps. It also uses the same WSDL. Any help is greatly appreciated.

Josh

API 5.0, VB.NET

I am having a problem that I can't seem to understand why it is occuring. I have a script that is attempting to manipulate about 6000 records. It requires 3 pieces of information from salesforce, each in a differant table. In any case, if I run a raw count gathering just the first peice of data, It will go through all 6000 records without any issues. However, When I add in the second and third queries to the equation, I get the invalid query locator error... The two subqueries will never return more than 1 result based on how the query is set up, so I cant be getting the query locator error from that. In anycase, any assistance will be greatly appreciated..

While bool

For b = 0 To qr.records.GetUpperBound(0)

....

code

....

If qr.done Then

bool = False

Else

qr = binding.queryMore(qr.queryLocator)

End If

 

 

API 5  VB.net environment

Cheers

Josh

Hopefully this will be the last time I need to post for a while. In any case, having some difficulty with querymore. In my code, I can get it to work until I add in the following code.

updowner.Id = assetid

updowner.OwnerId = userid

conacc(0) = updowner

binding.update(conacc)

If I coment this one part out, the querymore option works without a problem, If I leave it in it dies with an invalid_query_locator error. Any help is appreciated as I am perplexed by this one..  API = 4.0    VB.net  Here is the section of code with a problem. Thanks in advance

Josh

While bContinue

 For b = 0 To qr.records.GetUpperBound(0)

 Dim l As salesforce.Assets__c = CType(qr.records(b), salesforce.Assets__c)

 assetid = l.Id

 accountid = l.Customer_Number__c

 soql2 = "select OwnerId from account where id = '" & accountid & "'"

 Try

  Dim qs As salesforce.QueryResult = Nothing

  binding.QueryOptionsValue = New salesforce.QueryOptions

  qs = binding.query(soql2)

  c = 0

  If qs.size > 0 Then

   For c = 0 To qs.records.GetUpperBound(0)

    Dim m As salesforce.Account = CType(qs.records(c), salesforce.Account)

    userid = m.OwnerId

   Next

  End If

  Catch ex As Exception

  MessageBox.Show(ex.Message)

 End Try

 Dim updowner As New salesforce.Assets__c

 Dim conacc(1) As salesforce.sObject

 updowner.Id = assetid

 updowner.OwnerId = userid

 conacc(0) = updowner

 binding.update(conacc)

 'MessageBox.Show(userid & " : " & userid)

 Console.WriteLine(b & ":" & l.Id & ":" & accountid & ":" & userid)

 Next

 If qr.done Then

 bContinue = False

 Else

 qr = binding.queryMore(qr.queryLocator)

 End If

End While

What is the easiest way to use or statments in your query. What I currently have does not seem to want to work right and returns a malformed query. Thanks in advance.

zipfind1 = "BillingPostalCode = '" & zip & "'"

soql1 = "and type != '" & typec & "' or type != '" & typem & "'"

soql2 = "select id from account where " & zipfind1 & soql1

 

Dim qr As salesforce.QueryResult = Nothing

binding.QueryOptionsValue = New salesforce.QueryOptions

qr = binding.query(soql2)

c = 0

If qr.size > 0 Then

Console.WriteLine("blah")

For c = 0 To qr.records.GetUpperBound(0)

Dim m As salesforce.Account = CType(qr.records(c), salesforce.Account)

id = m.Id

 

API 4.0

VB.net 2003

 

Thanks again

Josh

Next

End If

Greetings All

  Quick question. Having an issue with changing the account owner on one of our custom tabs. Simply put, I am trying to change the owner of an asset the same owner of the associated account. Im pulling the owner ID from the associated account without any issues, however, I'm having issues trying to use that same owner ID to change the asset owner. It's probably something simple Im missing, But I cant see it. Anyway, Any help is appreciated.

Thanks

 

Josh

API = 4.0

VB.NET

Dim updowner As New salesforce.Assets__c

Dim conacc(1) As salesforce.sObject

updowner.OwnerId = userid

conacc(0) = updowner

binding.update(conacc)

Hello All,

     Getting a new message that I havent seen before. I have a Login sub that automates the login as well as keeps my connection from going stale. Normaly, how it works is that after  a set amount of time, it will logout and log back in so that I don't run into a session timeout error. In anycase, I set it to pop up the error messages as they com along and I get this error

 "client found response content type of ", but expected 'text/xml'." 

As a note, ive run programs with this script succesfully for several months without any issues. Are there any changes I should know about? or is this something differant. The login script is provided below. As you can see, it is the standard login script provided by the sample. Any help is appreciated. Thanks in advance...  

Josh

 

Public Sub login()

Dim un As String = "jlockhart@bbsjax.com"

Dim pw As String = "*******"

 

'//Provide feed back while we create the web service binding

Console.WriteLine("Creating the binding to the web service...")

Status.Text = "Creating the binding to the web service..."

 

'* Create the binding to the sforce servics

binding = New salesforce.SforceService

binding.Timeout = 60000

 

Console.WriteLine("LOGGING IN NOW....")

Status.Text = "Logging in now"

loginRes = binding.login(un, pw)

 

Console.WriteLine(vbCrLf & "The session id is: " & loginRes.sessionId)

Console.WriteLine(vbCrLf & "The new server url is: " & loginRes.serverUrl)

'//Change the binding to the new endpoint

binding.Url = loginRes.serverUrl

'//Create a new session header object and set the session id to that returned by the login

binding.SessionHeaderValue = New salesforce.SessionHeader

binding.SessionHeaderValue.sessionId = loginRes.sessionId

Debug.WriteLine(loginRes.sessionId)

loggedIn = True

End Sub

Hey all,

Im getting an error that I cant seem to correct. I am trying to write a test query that will first iterate through a SQL table, and then, if there are no matches, add the new information to SForce. I've managed to correct all issues but this one. After I run the try statement that gets all the needed values, there is the statements

              

Dim sr() As SaveResult = binding.create(accs)

unfortunantly, (accs) comes back with the following error:

 

Value