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

vbscript - sforcetoolkit - update a custom object help

I am trying to update a custom object after I have already queried it but receive the error 'object required' on my web page.  The error points to the line of code:  sobj.item("Id").value = "a0440000006d1DM"
I saw some information on the discussion boards related to updates in VBA but cannot get this to work in vbscript.  What I have missed?
 set binding = CreateObject("SForceOfficeToolkit.SForceSession")
    binding.SessionId = sSessionId
 set sobj = binding.CreateObject("WEFSN__c")
 sobj.Item("Id").value = "a0440000006d1DM"
 sobj.Item("Item_Number__c").value = "MIKE"
Mike Schumacher
Ron HessRon Hess
rather than CreateObject() you would need to create an SObject and then set the ID.
there is some VB code inside the Excel Connector that you can look at for examples of creating new records using the office toolkit. 
Ron HessRon Hess
So, the call you want is CreateEntity("WEFSN__c")

so , 

set sobj = binding.CreateEntity("WEFSN__c")

will create an sobject that you can populate
I tried using the CreateEntity but still received the errror:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'binding.CreateEntity'
What I did was run a query to select the record to update, use the 'for each sobj in queryResults', loaded the object sobj.
For the update, I issued 'sobj.update'.  I can now get the record updated.
Thanks for the ideas as they helped me get to the solution I am using now.
If the binding.CreateEntity should have worked in my vbscript webpage and you think of something I still missed, let me know.  Otherwise, I am moving forward today.
Thanks again.
Ron HessRon Hess
go with what works, my code was from VBA, so may not work directly without more debugging.
getting the object from the server, then doing the update is safe.