VBScript Integration Issues After Dynamics GP 10.0 Upgrade? Here's the Fix

Table of Contents

Hey everyone! Running into some pesky VBScript issues after upgrading your Dynamics GP to version 10.0? You’re not alone! That dreaded “DOC 1 ERROR: Object required” message can be a real headache. But don’t worry, we’ve got the fix right here. Let’s dive in and get those integrations running smoothly again.

VBScript Integration Issues
image just illustration

Understanding the Problem: Why the Error?

Upgrading to Integration Manager 10.0 can cause hiccups in your VBScript integrations. This is because the old RetrieveGlobals code isn’t compatible anymore. The system now uses new ADO connection objects. So, if you’re seeing that “Object required” error, it’s likely because your VBScript is still using the outdated RetrieveGlobals format.

The Solution: Updating Your VBScript Code

The good news is, the fix is pretty straightforward. We just need to update your VBScript to use the new GPConnection object and the correct ADO connection setup.

Step 1: Updating the UofM Field

First, locate this line in your code:

uom = SourceFields("ItemPriceUpdate.UofM")

Change it to this:

uom = SourceFields("Item Pricing Specific.UofM")

This step aligns your script with the Integration Manager 10.0 Inventory Item sample integration.

Step 2: Removing the Outdated RetrieveGlobals Object

Comment out this line:

'Set userinfo = CreateObject("RetrieveGlobals9.retrieveuserinfo")

It’s not needed anymore!

Step 3: Creating a New ADO Connection Object

Comment out the old line that used the userinfo object’s Connection method:

'Set cn = userinfo.Connection

And add this new line to create the ADO connection object correctly:

Set cn = CreateObject("ADODB.Connection")

Step 4: Specifying the Company Database

With the GPConnection object, you have to specify the company database before passing the ADO connection.

Comment out the old line:

'cn.DefaultDatabase = userinfo.intercompany_id

And add this new line:

cn.ConnectionString = "database=" & GPConnection.GPConnInterCompanyID

Step 5: Opening the Connection

Almost there! Now we need to open the connection. Add this line:

GPConnection.Open(cn)

Step 6: Cleaning Up

Finally, comment out this line, as we didn’t create the userinfo object:

'Set userinfo = Nothing

The Complete Updated VBScript Code

Here’s the complete, updated code you can use. Feel free to copy and paste this directly into your Inventory Item sample integration’s After Document script event.

'Integration Manager 10.0 VBScript code
'A similar version can also be found in the Integration Manager Script Library
Dim cn, cmd, rst, userinfo, Item, uom

Item = SourceFields("Inventory Item Main.ItemNumber")
uom = SourceFields("Item Pricing Specific.UofM") 'Old Integration Manager 9.0 code
'Create the retrieveglobals object
'Set userinfo = CreateObject("RetrieveGlobals9.retrieveuserinfo") 'Create the ADO connection object using RetrieveGlobals
'Set cn = userinfo.Connection
'cn.DefaultDatabase = userinfo.intercompany_id


'New Integration Manager 10.0 code
Set cn = CreateObject("ADODB.Connection")
cn.ConnectionString = "database=" & GPConnection.GPConnInterCompanyID
GPConnection.Open(cn) 'Create the ADO command object
Set cmd = CreateObject("ADODB.Command")
cmd.ActiveConnection = cn

cmd.CommandText = "Update IV00101 Set PRCHSUOM = '" & uom & "' where (ITEMNMBR='" & Item & "')"
Set rst = cmd.Execute

'release objects
Set rst = Nothing
Set cmd = Nothing
Set cn = Nothing
'Set userinfo = Nothing

A Look Back: The Old Way (Integration Manager 9.0)

Just for reference, here’s how things looked in Integration Manager 9.0. This code used the RetrieveGlobals9.dll to create the ADO connection. We’ve updated it above, but it’s always helpful to see where we came from:

(Example of the old code - Don’t use this!)

Key Takeaways: What We’ve Learned

  • The Problem: Upgrading to Dynamics GP 10.0 and Integration Manager 10.0 can break your VBScript integrations due to changes in how ADO connections are handled.
  • The Solution: We’ve walked through the steps to update your VBScript, replacing the outdated RetrieveGlobals code with the new GPConnection object and correct ADO setup.

We hope this guide has been helpful in getting your VBScript integrations back on track! If you have any questions or run into any snags, feel free to drop a comment below! We’d love to hear from you and help you out. And be sure to check back for more tips and tricks on all things Dynamics GP!

Post a Comment