Inventory Adjustment header Script to update UDF's in transaction Tier Distribution table

SOLVED

Sage100 v2014 Standard.

I'm trying to update some UDF's in the IM_TransactionTierDist table, during IM Transaction Entry, using a header trigger.  (Testing using a button script, but this will be deployed as an event trigger script).  Valuation for the items in question is Lot, if you're curious.

The code below is what's causing me difficulty.  (sTransactionType & sTransactionNo are set properly in advance, providing a proper partial lookup filter).  The oTierDist.MoveFirst() causes the script to crash, presumably (after checking the help files) because MoveFirst() does not appear to be a method for IM_TransactionTierDistribution_Bus.

That leaves me with the question.  How do I work with rows in IM_TransactionTierDist, from a header trigger script?  The UI appears to only allow a 1-1 tier to detail line ratio, but I can't even seem to find a way to grab a tier distribution row from something in IM_TransactionDetail (oBusObj.Lines, which I went through earlier in the script for some logic validation before trying to get at the tier distribution data).

(Before anyone suggests it, I cannot use a trigger in IM_TransactionTierDist and oBusObj because the business logic I need to handle requires transaction level processing).

' get the tier distribution object
oTierDist = oSession.GetObject("IM_TransactionTierDistribution_Bus")
if oTierDist <> 0 then
    Set oTierDist = oSession.AsObject(oTierDist)
    retVal = oSession.AsObject(oSession.UI).MessageBox("", "Set the oTierDist object") ' no problem here
else    
    retVal = oSession.AsObject(oSession.UI).MessageBox("", "Error opening tier distribution object.")
    exit sub
end if

' use .SetBrowseFilter(filter) to limit the rows to the current transaction
retVal= oTierDist.SetBrowseFilter(sTransactionType & sTransactionNo) ' this returns a 1, confirmed with the pop-up below

retVal = oSession.AsObject(oSession.UI).MessageBox("", "About to get the first Tier Dist line... " & sTransactionType & sTransactionNo & " " & cstr(retVal)) ' I see this, and everything looks OK then...
retVal = oTierDist.MoveFirst()
retVal = oSession.AsObject(oSession.UI).MessageBox("", "After getting the first Tier Dist line... ") 'I never see this

Any assistance would be appreciated.

Parents Reply Children
No Data