Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP forum
Suggested answer

Integration Manager VBScript for eConnect - Destination Settings

Posted on by 3,812

I need to add VBScript to update a secondary Table for each Purchase Order (PO) that is imported using the Integration Manager. The PO Integration uses eConnect Adapter. How can I automatically use the Company Database name in the "Destination Settings" Window to create Connection in the VBScript? I find that if we use the "GPConnection.GPConnInterCompanyID" variable, it will retrieve the Company Database based on GP Application that is running and not the "Destination Settings" window. Basically I like to use the same VBScript for both Production and Test Company without hard-coding the Database name in the Script. Following is a sample of the VBScript that I am writing.

After Document Script:

Set recset = CreateObject("ADODB.Recordset")
Set MyCon = CreateObject("ADODB.Connection")
MyCon.Connectionstring = "database=" + GPConnection.GPConnInterCompanyID
GPConnection.Open (MyCon)

updatecommand = "Update POCategoryListTable set [POCategory]= '" & SourceFields("POPHeader.POCategory") & "' where [PONumber]='" & SourceFields("POPHeader.PONumber") & "'"
recset = MyCon.Execute(updatecommand)
MyCon.Close

Following is the Destination Setting window in Integration Manager for PO.

pastedimage1580582632081v1.png

Please Advise. Thank you!

  • Suggested answer
    Isaac Olson Profile Picture
    Isaac Olson on at
    RE: Integration Manager VBScript for eConnect - Destination Settings

    Hello, 

    I am not aware of any way to reference the Destination Settings in your VBA scripting, and I do not believe that it would be possible.  The 2 solutions that you listed would be my recommendation as well. 

    1. Either have the company that you are integrating to open in GP so that your connection is pointing to the right place without hard coding it. 

    2. Copy the integration so that you have a test copy and a live copy and hard code the scripting.  

    Another option would be to add a column in the source file itself for whichever company the integration is for and reference that when creating your update statement.  

    Thanks, 

    Isaac Olson

    Microsoft Support

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,554 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Product updates

Dynamics 365 release plans