• bhayhow
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
I'm trying to create a new 'contact' using via classic ASP. I'm looking for some working sample code to create an object and set field values.

Here is my code so far, based on ideas gleaned from messages within this forum:

1. dim sf_object(0)
2. set sf_object(0) = binding.CreateObject("contact")
3. set result = binding.Create (sf_object, False )

-------------------------

Line 2 works.

Line 3 generates this error:

One of the records in the batch call resulted in an error.
Examine the records to determine which one(s) failed.

-------------------------

Am I supposed to set field values in sf_object before I call 'create'? Are there required fields that must be set for the 'create' call to work correctly?

Also, how do I set field values? I've tried the following:

sf_object(0)("lastname") = "test"

But this fails - perhaps because the 'create' call did not succeed?

-------------------------

Thanks for your help.
Bill Hayhow
I'm just getting started with VS 2005 and the API. My lanugauge preference is VB and I'm developing an ASP.NET application.

I'm having trouble finding the right components & code to read Salesforce data.

I have the Quickstart in VB.Net and in the 'Web References/sforce' folder, there is a 'references.vb' file with what appears to be extensive class definitions for Salesforce objects. When I put this code in VS 2005, I get lots of errors.

I have seen references to 'WSDL' files, either the 'enterprise' or 'partner' varieties. In my VS 2005 app, I have a 'sforce.wsdl' file, that appears to be a 'partner' WSDL, but it has only 'generic' class definitions. For example, it doesn't have a definition for 'contact' or 'lead'.

I have the following code working in my app:

Dim qr As sforce.QueryResult = Nothing
Try
qr = binding.query("select lastname,firstname from contact")
Catch eThis As Exception
Response.Write(eThis.Message + vbCrLf + eThis.StackTrace)
Return
End Try

Response.Write(qr.records.GetUpperBound(0))
Dim DescribeSObjectResult As sforce.DescribeSObjectResult = binding.describeSObject("contact")

Dim fieldList As String
Dim fields() As sforce.Field = DescribeSObjectResult.fields
For i As Integer = fields.GetLowerBound(0) To fields.GetUpperBound(0)
Dim fieldName As String = fields(i).name
Dim fieldType As String = fields(i).type
Response.Write("

name: " & fieldName & " type: " & fieldType & "

")
Next

This code displays the number of 'contacts' and the fields in the contact table. How do I access the individual records and fields in my query result? All of my attempts to work with 'qr' as an array have generated errors.

Questions:

1) Am I using the right approach/components for connecting via SFORCE? If not, what are the right components and what is the right approach?

2) Where can I get some useful sample code for VB? The API documentation only has Java and C# sample code. The VB Quickstart code appears to be for VB.NET, not ASP.NET.

Thanks you,
Bill Hayhow
I'm using the Office Toolkit within Classic ASP.

I have a sample applications working 'locally', that is via Visual Studio 6.0 running on my local PC.

When I try to run the same application on my server, I get the following error:

"The requested lookup key was not found in any active activation context."

The Office Toolkit has been installed on the server and it appears that the correct registry entries are in place.

I have the following entry in my Global.asa file:



Do you have any ideas as to what the problem may be - and how to resolve it?

Thanks,
Bill Hayhow
I'm exploring the concept of using Classic ASP to interface with a salesforce.com application. I'm using Visual Interdev 6.0 (Visual Studio 6.0).

I installed the Office Toolkit and then I found some sample code including the following line:

set SForceAPI = server.CreateObject("SForceOfficeToolkitLib3.SForceSession3")

This generates an error:

Server object: 006~ASP 0177~Server.CreateObject Failed~Invalid class string

Is this the right code to initiate a session?

Is there additional installation/configuration work required to make the toolkit work with ASP?

I tried out the sample code in Visual Basic 6.0 and it appears to work OK.

Can anyone point me to further information/samples for using ASP & the Office Toolkit?

Thanks for your help.
Bill Hayhow
I'm using ASP classic to connect to salesforce.
 
Here's the code:
set sfApi = Server.CreateObject("SForceOfficeToolkit3.SForceSession3.1")
 result = sfApi.login(username,password)
 response.write result & "<br/>"
 response.write "Error = " &  sfApi.errormessage & "<br/>"
 
Here's the output:
false
Unable to send request to server. The requested lookup key was not found in any active activation context.
 
I'm positive that the username/password is correct.  I found a post that suggested permissions issues with this error so I tried correcting that but with no result.
 
any ideas?
I'm using the Office Toolkit within Classic ASP.

I have a sample applications working 'locally', that is via Visual Studio 6.0 running on my local PC.

When I try to run the same application on my server, I get the following error:

"The requested lookup key was not found in any active activation context."

The Office Toolkit has been installed on the server and it appears that the correct registry entries are in place.

I have the following entry in my Global.asa file:



Do you have any ideas as to what the problem may be - and how to resolve it?

Thanks,
Bill Hayhow