Scripting

  • 1.  Hi there,We need a sales order details script th

    Posted 06-12-2017 07:13
    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 ------------------------------------


  • 2.  RE: Hi there,We need a sales order details script th

    Posted 06-12-2017 07:32
    Can we make any 'business process' assumptions, like kit components always immediately proceed the kit header and are always in the same order? And any extras are ordered as separate line items?


  • 3.  RE: Hi there,We need a sales order details script th

    Posted 06-12-2017 07:35
    Hi Steve - Yes I think we have to - I've even thought we may have to have extras on a separate order.


  • 4.  RE: Hi there,We need a sales order details script th

    Posted 06-12-2017 09:33
    Marc, it does look like you will need to put your loop through the sales order lines at the pre-totals level. To recognize a kitted finished good item, the SalesKitLineKey$ should be the same as the LineKey$ and the ExplodedKitItem$ = ""Y"". Now once you find one that has a DropShip$ = ""Y"" then you can set a variable like, tmpKitLineKey$ = SalesKitLineKey$ and then go to the next record. The next record(s) will be the corresponding components so their SalesKitLIneKey$ will be the same as the one on the kitted item and the ExplodedKitItem$ will be ""N"" so I would think you can look for these two fields to set your DropShip$ on the component accordingly. Hope this makes sense.


  • 5.  RE: Hi there,We need a sales order details script th

    Posted 06-27-2017 15:03
    Thank you @MarcosDeLuna ! This worked! It appears that the kit component lines all have the kitLineKey value set, so I looked for that value and set my drop ship flag accordingly. Works great! thanks again!


  • 6.  RE: Hi there,We need a sales order details script th

    Posted 06-27-2017 19:07
    My pleasure, Marc. Glad to help.