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!