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
chisholmdchisholmd 

Office edition documentation

Will there be any documentation for SF_MSApi.dll ?

My first test code only gets this far

Dim s As SForceOfficeToolkitLib.SForceSession
Set s = New SForceOfficeToolkitLib.SForceSession

If s.Login("xxxxxx", "xxxx", False) Then
    Set rs = s.Query("select firstname, lastname from contact", False)
End If

No problems getting this far but Im using vb6 and I can't make out how to get access to the records within the result set. I thought the whole point of COM development is that the properties and methods were thesame accross plateforms. I have tried various combinations of getRecords() or records shown in other samples but everything I try throws a method not found error.

Object Browser only shows 4 properties for a queryResultSet object (EntityType,error,erromessage,tag) The entityType returns "Contact" which I expected but I can't figure out how to get from there to the othe part of the hierchy SObject that seems to contain the fields collection.

Anyone?

 

 

 

chisholmdchisholmd

Nevermind

If s.Login("xxxxxx", "xxx", False) Then
    Set con = s.CreateObject("contact")
    MsgBox (con.Queryable)
    Set rs = s.Query("select firstname, lastname from contact", False)
    For Each r In rs
        For Each f In r.Fields
            MsgBox (f.Name & ": " & f.Value)
        Next
    Next
End If

ScotScot

There is a pilot program underway with with this DLL. No documentation yet, but some samples. See - http://forums.sforce.com/sforce/board/message?board.id=VB_development&message.id=168

Scot

Garry LindsayGarry Lindsay

Hey, if you have any test code so far, I would love to see it.

I am thinking I may have to build my own COM object in .NET and call that from ASP and VB6 until the doc comes out.

Doing it this way, I feel like Inspector Clueso, haha!

Garry LindsayGarry Lindsay

Wierd error from ASP

strFieldName = TRIM(fieldNames(i))

Response.Write "Name : " & strFieldName

Set fld = sobj.Item(strFieldName)

gives a number of different errors :-

Name : FirstName

SForceOfficeToolkit.SObject.1 error '80004005'

Invalid field index::26628

/appsynthesis/appmanager/includes/classes/sForce/clssForceHelper.asp, line 193

 

then during a page refresh I get :-

Name : FirstName

SForceOfficeToolkit.SObject.1 error '80004001'

Unsupported field index type

/appsynthesis/appmanager/includes/classes/sForce/clssForceHelper.asp, line 193

 

Then another refresh gives :-

Name : FirstName

SForceOfficeToolkit.SObject.1 error '80004005'

Invalid field index::4900

/appsynthesis/appmanager/includes/classes/sForce/clssForceHelper.asp, line 193

Very odd, but when I run this :-

Set fld = sobj.Item("FirstName")

It works just fine??????? Seems like hardcoding the field name into the call is OK, but using a variable is not, and yes the variable strFieldName is DIM ed at the begining of the function

Any ideas, helppppp

Cheers

Garry

DevAngelDevAngel

Hi Garry,

Where are the values in the fieldnames array coming from?  Can you email me the asp page (sforce@salesforce.com)?

Garry LindsayGarry Lindsay

Oh, actually this code fails as well!

Dim strFieldName

Dim qrs

Dim fld

Dim sobj

Set qrs = p_sfdc.Query("Select FirstName from Lead", False)

For Each sobj In qrs

 strFieldName = "FirstName"

 Set fld = sobj.Item(strFieldName)

Next

This is the error

SForceOfficeToolkit.SObject.1 error '80004005'

Invalid field index::26628

/appsynthesis/appmanager/includes/classes/sForce/clssForceHelper.asp, line 193

 

then during a page refresh I get :-


SForceOfficeToolkit.SObject.1 error '80004001'

Unsupported field index type

/appsynthesis/appmanager/includes/classes/sForce/clssForceHelper.asp, line 193

Howere this code works fine

Dim strFieldName

Dim qrs

Dim fld

Dim sobj

Set qrs = p_sfdc.Query("Select FirstName from Lead", False)

For Each sobj In qrs

 strFieldName = "FirstName"

 Set fld = sobj.Item("FirstName")

Next

Any ideas?

Cheers

Garry

Garry LindsayGarry Lindsay

Has this DLL been released yet? If so, where is available for download and documentation?

 

Cheers

Garry

DevAngelDevAngel

Yes. Login to salesforce.com account and from the setup pages, install the Office Edition.  The dll is deployed with the office edition.

 

Documentation is still being baked.

Garry LindsayGarry Lindsay

I am having trouble deleting a record from the Lead object

Here is the code

  soql = "Select ikap_applicant_id__c from Lead Where ikap_applicant_id__c = '489852'"

  Set qrs = p_sfdc.Query(soql, False)
  
  strError = "There is no sForce field that exists with Key Field : " & strSForceKeyField
  
  If p_sfdc.Error = NO_SF_ERROR Then
   For Each sobj In qrs
    Response.Write("Deleting <b> " & strFullName & "</b>, applicantID : <b>" & applicantID & "</b> record in SalesForce...<br>")
    Response.Flush 
    
    sobj.Delete >>>>>>>>>>>>> line 362
    sobj.Refresh
    
    bRet = TRUE
   Next
  Else
   strError = "There was an error during the query operation." & vbCrLf & vbCrLf & p_sfdc.ErrorMessage
   bRet = FALSE
  End If

Here is the result

Communicating with SalesForce Web Service. This may take a 1 to 10 minutes... Please wait...

Deleting Elizabeth Jones, applicantID : 489852 record in SalesForce...

SForceOfficeToolkit.SObject.1 error '80004005'

org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.

/appsynthesis/backendmanager/includes/classes/sForce/clssForceHelper.asp, line 362

 

 Any ideas?

Cheers

Garry

DevAngelDevAngel

Hi Garry,

Seems there is another method for doing a delete.  I'm not familiar with the method you posted.  Below is how I delete a Contact that was retrieved using a query on ID:

        Dim sobj As SObject
        Dim sobjs(0) As SObject
        'Using the standard method of accessing QueryResultsSet to get the one sobject (Contact)
        'that is returned from the query
        For Each sobj In qrs
            Set sobjs(0) = sobj
        Next
       
        On Error GoTo Error_Delete
       
        'Call the delete method sending our single element array of sobjects
        sfdc.Delete sobjs, False