Sage 100

 View Only
  • 1.  Script fires on test system but does not fire on misc. items and misc. charge on live system

    Posted 08-03-2022 19:04
    Sage 100 2020.1 Premium, script on Table prewrite for SalesOrderDetail:

    It works for all item types on my test system.  On the customer's live system, it does not seem to fire on types 3 or 5, only on 1.

    If the item type is 1, I get the messages before the item type check and then the final one where it falls through to else.
    However, for item type 3 or 5 (which is where I need it to do stuff) I don't get any of the messages.
    sDept = ""

    sItemType = ""

    sState = ""

    LeadTime = Date

    oUDT = 0

    sUDTDept = ""

    sMsgRetVal = oSession.AsObject(oSession.UI).MessageBox("in lead time script")

    retVal = oBusObj.GetValue("ItemType$", sItemType)

    retVal = oBusObj.GetValue("UDF_DEPARTMENT$",sDept)

    sState = oBusObj.EditState

    sMsgRetVal = oSession.AsObject(oSession.UI).MessageBox("","EditState " & sState)

    if (sItemType = "3" or sItemType = "5") and sDept > "" and oBusObj.EditState = 2 Then

    oUDT = oSession.GetObject("CM_UDT_svc", "SO_UDT_CAPACITYBYDEPT")

    If oUDT <> 0 Then

    Set oUDT = oScript.AsObject(oUDT)

    retVal = oUDT.Find(sDept)

    if retVal = 1 then

    retVal = oUDT.GetValue("UDF_LEADTIME$",LeadTime)

    sMsgRetVal = oSession.AsObject(oSession.UI).MessageBox("",Cstr(LeadTime))

    retVal = oBusObj.SetValue("UDF_LEADTIME$",cstr(LeadTime))

    End if

    End If

    Else

    retVal = oBusObj.SetValue("UDF_DEPARTMENT$","")

    End if




    ------------------------------
    Phil McIntosh
    President
    Friendly Systems, Inc.
    ------------------------------


  • 2.  RE: Script fires on test system but does not fire on misc. items and misc. charge on live system

    Posted 08-03-2022 19:11
    If you aren't even getting the "in lead time script" message, I can only think of two things:
    • A different script is running "DeactivateProcedure"... for those lines.
    • You have a second script with the same priority running on the same trigger, and it is doing an "exit sub" before getting to this one... for those lines.


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



  • 3.  RE: Script fires on test system but does not fire on misc. items and misc. charge on live system

    Posted 08-03-2022 19:24

    Also you might want to check for sDept like this:

    Len(sDept) > 0


    ------------------------------
    Alnoor Cassim

    Email: alnoor.cassim@90minds.com
    Ph:
    ------------------------------



  • 4.  RE: Script fires on test system but does not fire on misc. items and misc. charge on live system

    Posted 08-04-2022 08:15
    @Alnoor Cassim Thanks!  Good idea!​

    ------------------------------
    Phil McIntosh
    President
    Friendly Systems, Inc.
    ------------------------------



  • 5.  RE: Script fires on test system but does not fire on misc. items and misc. charge on live system

    Posted 08-04-2022 08:14
    @Kevin Moyes Thanks!  Changed to 400 and all is well.​

    ------------------------------
    Phil McIntosh
    President
    Friendly Systems, Inc.
    ------------------------------



  • 6.  RE: Script fires on test system but does not fire on misc. items and misc. charge on live system

    Posted 08-04-2022 10:02
    Good! 
    It's never a good idea to use the same priority for multiple scripts on the same event.  That merges the scripts when compiled, which can change the way things work.

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