
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.
Please Advise. Thank you!
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