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 

COM toolkit Retrieve from VBScript fails; same works within VBA?

Using the COM toolkit, the following statement:

    set oppresult = binding.retrieve("*","Opportunity","00600000006yrtO",False)

works fine for me when called within Excel 2003 VBA, but fails when called in vbscript with the message:

   "An error occured while building the GetUpdated or GetDeleted request, check your date parameters"

In the failing case, the code includes:

   Set binding = CreateObject("SForceOfficeToolkit.SForceSession") 
   MeSession = binding.Login(UserName2, PassWord2, False)
   If Not MeSession then return

   oppID = "00600000006yrtO"
   Dim oppResult
   oppResult = binding.Retrieve("*","Opportunity",oppid,false)

I have also tried using a list of fields in place of the asterisk; this also works in VBA, fails in vbscript.

Any hints?

ScotScot

I no longer need help on this one.
The problem, needless to say, has nothing to do with GetUpdated or GetDeleted date parameters.

It is that the idlist must be either a constant or an array, thus:

This fails:
     dim oppid
     oppid = "00600000006yrtO"
     set opp = binding.retrieve("*","Opportunity",oppid,false)

But this works:
     set opp = binding.retrieve("*","Opportunity","00600000006yrtO",false) 

The fix is to build a single element array, as in:
     dim oppid(0)
     oppid(0) = "00600000006yrtO"
     set opp = binding.retrieve("*","Opportunity",oppid,false)

Scot