Scripting

  • 1.  Pull Header or Lines detail into Tier Distribution

    Posted 12-10-2025 12:21

    Hello,

     I am trying to pull a piece of data from the Header of a PO Receipt into a UDF on the Tier Distribution.

    I've tried all the ways I know, but nothing is working.

    I then scripted the Header field to the Lines table so now I could pull it from Lines into Distribution, but I can't find a good link between the tables.

    What is the best way to call this connection up? oHeaderObj & oLines don't seem to work. I've tried setting the table as an object, but this record is not yet written to find the record. Is there a Child Handle available? Hoping for some hidden link or trick here... 

    Thanks!!



    ------------------------------
    Dana Young
    Lehman Wesley
    Lansing, MI
    ------------------------------


  • 2.  RE: Pull Header or Lines detail into Tier Distribution

    Posted 12-10-2025 12:45

    https://communityhub.sage.com/us/sage100/f/business-object-interface/93781/inventory-adjustment-header-script-to-update-udf-s-in-transaction-tier-distribution-table/267076#267076 



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 3.  RE: Pull Header or Lines detail into Tier Distribution

    Posted 12-12-2025 14:33

    So, I need to trigger it from the header & push into the tier distribution, looping through all the lines? I can't trigger from the tier distribution to pull oHeaderObj data into a tier event?



    ------------------------------
    Dana Young
    Lehman Wesley
    Lansing, MI
    ------------------------------



  • 4.  RE: Pull Header or Lines detail into Tier Distribution

    Posted 12-12-2025 14:40

    I don't know the syntax for going "up" from the tiers. 

    My example started from the header, but you should be able to start from the lines (pre-write, filtered to ItemTypes that have tiers), get the Header value from oHeaderObj, then use oBusObj.Distribution to push the values down into the tiers for that line (...tier loop, not line loop).



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 5.  RE: Pull Header or Lines detail into Tier Distribution

    Posted 12-12-2025 15:40

    Got it! Thank you for your help!!

    I already had the part that pulled it from the Header to the Lines, but you helped with the Lines to Distribution!

    'Set the Supplier name per Lot on PO Receipt
    sName = ""
    sType = ""
    retVal = oHeaderObj.GetValue("PurchaseName$",sName)
    reVal = oBusObj.SetValue("UDF_SUPPLIER_NAME$",sName)
    retVal = oBusObj.GetValue("ItemType$",sType)
    if sType = "1" then
    Set oTierDist = oSession.AsObject(oBusObj.Distribution)
    retVal = oTierDist.MoveFirst()
    Do Until CBool(oTierDist.EOF) = True
    retVal = oTierDist.SetValue("UDF_SUPPLIER_NAME$",sName)
    retVal = oTierDist.Write()
    retVal = oTierDist.MoveNext()
    Loop
    End  If



    ------------------------------
    Dana Young
    Lehman Wesley
    Lansing, MI
    ------------------------------