Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Integration Manager Script

Posted on by

Hi Forum,

I am receiving the following error when I run an integration containing a script. The script says it has compiled successfully and is to populate the Item Resource Planning window of Inventory Item Cards. Any assistance would be appreciated

Object reference not set to an instance of an object.

Error Compiling Script 'After Document' Line 2: - Expected end of statement

Expected end of statement

The script is as per below

strSQL = "MyCon.ConnectionString = 'database=' & GPConnection.GPConnInterCompanyID " & _

              "GPConnection.Open(MyCon) " & _

              "Update IV00102 " & _

              "set ORDERPOLICY = SourceFields('AH Inventory Item.Order Policy') " & _

              "Where ITEMNMBR = SourceFields('AH Inventory Item.Item Number'), LOCNCODE = SourceFields('AH Inventory Item.Site') " & _

              "set MNMMORDRQTY = SourceFields('AH Inventory Item.Min Order Qty') " & _

              "Where ITEMNMBR = SourceFields('AH Inventory Item.Item Number'), LOCNCODE = SourceFields('AH Inventory Item.Site') " & _

              "set MXMMORDRQTY = SourceFields('AH Inventory Item.Max Order Qty') " & _

              "Where ITEMNMBR = SourceFields('AH Inventory Item.Item Number'), LOCNCODE = SourceFields('AH Inventory Item.Site') " & _

              "set ORDERMULTIPLE = SourceFields('AH Inventory Item.Order Multiple') " & _

              "Where ITEMNMBR = SourceFields('AH Inventory Item.Item Number'), LOCNCODE = SourceFields('AH Inventory Item.Site') " & _

              "set FXDORDRQTY = SourceFields('AH Inventory Item.Fixed Order Qty') " & _

              "Where ITEMNMBR = SourceFields('AH Inventory Item.Item Number'), LOCNCODE = SourceFields('AH Inventory Item.Site') " & _

              "set ORDRPNTQTY = SourceFields('AH Inventory Item.Order Point Qty') " & _

              "Where ITEMNMBR = SourceFields('AH Inventory Item.Item Number'), LOCNCODE = SourceFields('AH Inventory Item.Site') " & _

              "set ORDRUPTOLVL = SourceFields('AH Inventory Item.Order-Up-to-Level') " & _

              "Where ITEMNMBR = SourceFields('AH Inventory Item.Item Number'), LOCNCODE = SourceFields('AH Inventory Item.Site') " & _

              ""

Categories:
  • GV1 Profile Picture
    GV1 on at
    RE: Integration Manager Script

    Thank-you Derek, I really appreciated you taking the time to read and advise on the post. Much appreciated

  • Suggested answer
    RE: Integration Manager Script

    It appears that it has an issue with Line 2 of the script, which looks to be this line:

              "GPConnection.Open(MyCon) " & _

    Are we missing the line to close the connection? i.e. MyCon.Close

    RE: learn.microsoft.com/.../gpconnection-object-replaces-retrieveglobals-dll

    I'm also wondering if you need the &_ after the GPConnection.Open(MyCon) line?

    In most cases, we see the scripts written such as this example:

    GPConnection.Open(MyCon)

    IF IsNULL(sourcefields("ABS - Warehouse PO Line Items.LEGACYPRODUCTCODE"))= True Then

         itemString= Sourcefields("ABS - Warehouse PO Line Items.SUPPLIERPRODUCTCODE") + "-" + Sourcefields("ABS - Warehouse PO Line Items.SUPPLIERPRODUCTSIZE")

    Else

         itemString= sourcefields("ABS - Warehouse PO Line Items.LEGACYPRODUCTCODE")

    End If

       cmdString = "Select ITEMNMBR from dbo.IV00101 where (ITEMNMBR='" + itemString + "')"

       Set recset = MyCon.Execute(cmdString)

       If recset.BOF And recset.EOF Then

           'The end of the IV00101 listing was reached so item is non-inventoried

         CurrentField.Value=1

       Else

         'An entry in the IV00101 listing was found so item is inventoried

           CurrentField.Value=0

       End If        

           MyCon.Close

    I imagine there are many ways to script it out and the Community may have more ideas as to your error message.

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans
Liquid error: parsing "/forums/thread/details/?threadid=%27nvOpzp;%20AND%201=1%20OR%20(%3C%27%22%3EiKO))," - Too many )'s.