Hello,
I am working with an Add-on that is Autopacking a Delivery. The method Delivery.Update is executed for every package in the delivery. As the packages are created, the update takes longer each iteration. If a delivery has a larger amount of packages until it eventually will timeout (Approx: 250-300 packages). Here is the portion of the code that calls the update method.
Private Function CreateNewPackage()
nextpack = GetNextPackNumber(sDocEntry)
lDocEntry = CLng(sDocEntry)
Set oDelivery = g_oCompany.GetBusinessObject(oDeliveryNotes)
oDelivery.GetByKey (lDocEntry)
Set oTrcPackage = oDelivery.Packages
oPackage.Add
oPackage.SetCurrentLine (nextpack - 1)
oPackage.Number = nextpack
oPackage.Type = sPackType
oPackage.UserFields("U_X_UCC").Value = sUCCNum
oPackage.UserFields("U_X_CARTONCT").Value = lQuantity
oPackage.Items.ItemCode = sItemCode
oPackage.Items.Quantity = lQuantity
oPackage.Units = iWeightUom
oPackage.UserFields("U_X_BaseEntry").Value = sBaseEntry
'Puts the Package number on the status bar
m_oProgBar.Text = nextpack
If m_sAddSubItemPack = "Y" And m_sTreeType = "S" Then
'Code to package subitems
End If
oDelivery.Update
End Function
It appears that due to the long running query, the connection with the Add-On is terminated. Is there a way to increase the timeout settings or another method of updating the delivery?