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
ScotScot 

New version of the Toolkit is available

  The Office Edition beta was updated sometime within the last month to a version which supports the 4.0 API . 

To get the new DLL registered properly, I recommend that you uninstall the previous version of Office Edition and then install the new one from the Setup menu in salesforce.com.

The new Office Edition Excel Add-in reports itself as version 1.3.1.8.
The new Toolkit DLL installs in a sub-directory of 2.0 (vs. the original 1.0).

While we may discover some glitches in the future, the sforce Excel Connector appears to function transparently with the new version.  It now provides access to new objects (such as the AccountContactRole) and it allows updates to Multi-value picklist values. 

Garry LindsayGarry Lindsay

Using the Office edition is there anyway to find all the fields in the Lead object?

SOQL does not support SELECT * FROM LEAD allowing me to interate through all the returned leads.

And using object browser it looks as if there is no DescribeSObjectResult dsr = binding.describeSObject("Lead"); call that is available in the API 4.0 .NET DLL's

We have a client that keeps adding new custom fields to their Lead object and need to be able to retrive these, without hardcoding them in our code!!! We dont have the option to use .NET at the moment. Hence the need to use this VB COM+ DLL.

Apparently there is no doc yet, and object browser is limited.

Any idea on how I may achieve finding out what fields are in the LEAD object via ASP/VB?

 

Cheers

Garry

Garry LindsayGarry Lindsay

Any idea how to change the btach query size using the COM+ object?

I have looked at object browser and I am not finding the answer

In .NET you can do this :-

binding.QueryOptionsValue = new QueryOptions();
binding.QueryOptionsValue.batchSize = 3;
binding.QueryOptionsValue.batchSizeSpecified = true;

but I have no idea how to do it in ASP/VB

Cheers

Garry

ScotScot

Garry,

It appears that setting a SoapHeader (which is what the batch size is) is done via the SetSoapHeader method of the SforceSession.

You can find this one in VBA if you open the object browser, select the SForceSession class, and scroll down to the methods.  The help displayed there is:
       Sub SetSoapHeader(section As String, Name As String, Value As String).

Thus, I suspect that you should be able to set a batch size with:
       call binding.SetSoapHeader("QueryOptions","batchSize","1000")

(I have tested the call, which works, but not the results of it on subsequent queries)

Scot

ScotScot

Garry,

You can find all the fields by creating an object, and then iterating through its fields.

For example, to get the leads fields:

Sub testit()
Dim xx As SObject
Set xx = binding.CreateObject("lead")
For i = LBound(xx.Fields) To UBound(xx.Fields)
  Debug.Print xx.Fields(i).Name
  Next i
End Sub

You can replace "Name" with any of the attributes of the Field class, as shown by the object browser.

Scot

 

SuperfellSuperfell
Although SOQL doesn't support SELECT * FROM, The OfficeToolkit does, it will automatically do a describe and fill out the field list for you.
Garry LindsayGarry Lindsay

I get this error

 Microsoft VBScript runtime error '800a01c3'

Object not a collection: 'sobj.fields'

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

from this code

  Set sobj = p_sfdc.CreateObject(p_strCurrentObjectName)
  
  For i = LBound(sobj.Fields) To UBound(sobj.Fields)
   strKey = p_strCurrentObjectName&"."&sobj.Fields(i).Name <<<<<<<<<< line 291
   strValue = sobj.Fields(i).Label
   
   p_dictCurrentObjectFields.Item(strKey) = strValue
   p_dictCurrentObjectFieldsPickList.Item(strKey) = strValue
  Next

ScotScot

re: Toolkit supporting SELECT *

Nice!!!!

foghornfoghorn

Actually you can't access the fields array directly from vbscript, you have to use the Item collection.  Sooooo,

set sobject = session.CreateObject("lead")

for each i in sobject.Fields
    s
= s & "<br>" & i.Name
next

DumpText
"<br>All field names using for each<br>" & s

for i=0 to UBound( sobject.Fields )
   s
= s & "<br>" & sobject.Item(i).Name
next

DumpText "<br>All field names using item collection<br>" & s


sobject.Item("id").Name

 

ScotScot

Help ...

I think I'm running into exactly the issue described in the previous comment. I'm struggling to overcome my basic understanding of vbscript, and could use a hint ...

My goal: retrieve a set of information related to an opportunity, and test for some integrity constraints.

In my test case, in Excel, I have issued:
   retrieve("*", "Opportunity", oppid, false) to to get the opportunity values,
   retrieve("*", "Account", opp.item("AccountId").value, false) to get the account values, and
   query("Select " & fieldlist & " from OpportunityLineItem where OpportunityId = '" oppid &"'", false)
      to get the line items.

In order to get the objects from the result sets, I do some dummy for each loops, such as:
     Set oppResult = binding.Retrieve("*", "Opportunity", oppID, False)
     For Each o In oppResult         ' only one
         Set opp = o
         Next
which results in saved Sobjects of opp and acct.

Finally, my testing logic is a series of statements like:
       If acct.Item("GTGRelationship__c").Value = "" Then _
             adderror "ACDIV", "The Account is missing a division"
       If acct.Item("Area__c").Value = "" Then _
             adderror "ACAREA", "The Account is missing an Area" 
though the reality is much more complex, with nested tests involving multiple variables.

It appears that all the object.Item("itemname").value clauses don't work when I switch from VBA to vbscript. I need a mechanism which does not require that I use a FOR loop for each calcuation ... that is, I need one which allows me to refer to the values from salesforce by name in my expressions.

I know I must be missing something obvious.
Can anyone suggest how I do this?

 

ScotScot

This is no longer a problem; I have gotten it to work, though have not been able to isolate what change made the difference.