Scripting

  • 1.  Anyone have any experience with firing scripts whe

    Posted 07-18-2018 11:49
    Anyone have any experience with firing scripts when using StarShip to invoice or have orders automated from the web using Website Pipeline? I have a script adding a misc charge in SO Entry & SO Invoice Entry, but when an order comes from the web into SO Entry, it doesn't populate. When an invoice comes from StarShip, it doesn't populate. I've tried Pre-Totals, Pre-Write, Post-Write, but nothing is working. If I manually enter in either place, it works. sItemType = """" sItemCode = """" s301 = """" Ext = 0 TotExt = 0 Tariff = 0 Set oLines = oBusObj.AsObject(oBusObj.Lines) retVal = oLines.MoveFirst() Do Until CBool(oLines.EOF) = True retVAl = oLines.GetValue(""ItemCode$"", sItemCode) If sItemCode = ""/301TARIFF"" then retVal = oLines.Delete() End If retVal = oLines.MoveNext() Loop retVal = oLines.MoveFirst() Do Until CBool(oLines.EOF) = True retVal = oLines.GetValue(""ItemType$"", sItemType) retVal = oLines.GetValue(""UDF_301_TARIFF$"",s301) If sItemType = ""1"" and s301 = ""Y"" then retVal = oLines.GetValue(""ExtensionAmt"",Ext) TotExt = TotExt + Ext End If retVal = oLines.MoveNext() Loop Tariff = TotExt*.25 retVal = oLines.AddLine() retVal = oLines.SetValue(""ItemCode$"", ""/301TARIFF"") retVal = oLines.SetValue(""ExtensionAmt"", Tariff) retVal = oLines.Write()


  • 2.  RE: Anyone have any experience with firing scripts whe

    Posted 07-18-2018 11:59
    Is there anything at the top of your script that would limit how a SO could get created? Both WSP and Starship use BOI. So for your script to detect BOI as the source you would evaluate oSession.ObjectInterface. Maybe you have something like this in there?? BOI = oSession.ObjectInterface Updating = oSession.Updating StartProgram = oSession.StartProgram If (BOI or Updating or StartProgram <> ""SO_SALESORDER_UI) Then Exit Sub


  • 3.  RE: Anyone have any experience with firing scripts whe

    Posted 07-18-2018 12:01
    I had this in there, then commented it out to test without it... BadStart = 0 BOI = oSession.ObjectInterface InUpdate = oSession.Updating Security = oBusObj.SecurityAccess StartProgram = Trim(UCase(oSession.StartProgram)) If Right(StartProgram, 3) = ""_UI"" Then UI = 1 If (BOI > 0 or InUpdate > 0 or Security = 0) Then BadStart = 1 If BadStart <> 1 Then


  • 4.  RE: Anyone have any experience with firing scripts whe

    Posted 07-18-2018 12:05
    So by commenting all that out the script still doesn't run via WSP and Starship? (don't forget to recompile)


  • 5.  RE: Anyone have any experience with firing scripts whe

    Posted 07-18-2018 12:17
    I compiled everything again (thought I had done already, but who knows) & now it works for WSP on orders, but still not on invoices from StarShip. I also bumped it up on the priority because there are other scripts in there. Any thoughts on what kind of event it should be on the Invoice? They work entirely in SS & push into Sage Shipping Data Entry instead of being in Shipping & pushing out to SS.


  • 6.  RE: Anyone have any experience with firing scripts whe

    Posted 07-18-2018 12:42
    2 things: 1) Remember you have to lower the priority number (not increase it) to get a script to execute sooner. Eg. A script on an event with priority 400 will run before another script for same event on priority 500. 2) Since shipping / invoicing an order will copy all the original order lines over (regardless of whether you ship complete or partial), it should copy the /301TARIFF line over as well, assuming the order script fired off. When you're in Shipping Data Entry, do you see the tariff line get copied over (knowing your invoice script hasn't even fired off yet)? Also, do you have any restrictions on allowing misc charges in Shipping Data Entry?


  • 7.  RE: Anyone have any experience with firing scripts whe

    Posted 07-18-2018 13:02
    Yes, I have the priority a lower number, so that is good. The line does come over into Shipping Data Entry & into SO Invoice Data Entry, but it doesn't recalc. So, if there is a partial shipment, it wants to charge the full $ for the tariff instead of just the portion that is shipping/invoicing. I don't think there are any restrictions on misc charges.


  • 8.  RE: Anyone have any experience with firing scripts whe

    Posted 07-18-2018 13:10
    Check the retVal on your oLines.Delete. If it's 0 get the oLines.LastErrorMsg. You might want to test it as a button but refresh the grid too.