Hi there,
We need a sales order details script that marks the kit item to drop ship along with the components of the kit. I can get the kit flag from the main item, but cant seem to get the handle to the kit child items - or figure out when to fire the script to mark those items.
I'm assuming i'll need to do a pre-totals and roll through the sales order lines and look for Kit items (marked as kit in item master). Then when one is found (and this is where it gets fuzzy) match the kit lines on the so to the kit and flag them that way?? but what if there are multiple lines containing a component item (like i order a kit and it includes a desk set and a pen and then i also order extra pens so there are two detail lines for the pen item number).
Below is the easy part - figuring out what items are kits and flagging the main item as a drop ship:
'Only run in test company right now
If oSession.CompanyCode <> ""ABC"" Then Exit Sub
'Title:Check for kit when entering item
'then change item to Dropship and kit components to drop ship
'Desc: check line item in SO Order Entry
'Bus Object: SO_SalesOrderDetail
'Event: Column Post Validate ItemCode
'
'Notes:
'Version History
'
' 1.00 6.12.2017 - Check for kit item
' -------------------------SCRIPT START ------------------------------------
retval = oScript.DebugPrint(""*************START Kit Item Checking Script***********"")
sItemCode = """"
sItemType = """"
sComment = """"
QtyOrd = 0 ' quantity ordered
sDropShip = """"
retval = 0
sKitItem = """"
retval = oBusObj.GetValue(""ItemCode$"", sItemCode)'get the item number the user just entered
retval = oBusObj.GetValue(""ItemType$"", sItemType)'get the item type of the item number entered
retval = oBusObj.GetValue(""QuantityOrdered"",QtyOrd) 'Get the qty ordered
retval = oBusObj.GetValue(""ExplodedKitItem$"",sKitItem) 'get kit item Y or N flag
retval = oScript.DebugPrint(""skititem is "" & sKitItem)
if sKitItem= ""Y"" then ' if Kit Item
if sItemType = ""1"" then 'if this is an item code line then
retval = oBusObj.setvalue(""DropShip$"",""Y"")
end if
end if
retval = oScript.DebugPrint(sItemCode)
retval = oScript.DebugPrint(""*********END Kit Item Checking Script***************"")
' -------------------------SCRIPT END ------------------------------------