Scripting

oScript.SetUIControl not working

  • 1.  oScript.SetUIControl not working

    Posted 08-26-2024 16:53

    I have this method working in SO Entry where it shows or hides UDFs based on some logic. I have a default value set in the field value so it just shows that text value or hides it. I have all 4 fields placed on the screen & then make them borderless to look like headings.

    I copied the same thing over to PO Entry & its just not working. Same client, same company code.

    I have 4 UDFs for date headings. I want to show 2 of them when its a Drop Ship & then show the other 2 when its a Standard Order. So, I had it set to Hide on 2 & Show on 2 for one order type. Then vice versa on the other order type.

    I got frustrated & just set them all to "HIDE" & they just continue to show. I added some debugging & can see its getting thru the logic but then just not doing what it should be. I feel like I am missing something obvious & easy.

    sType = ""
    retVal = oBusObj.GetValue("OrderType$",sType)
    r=oScript.DebugPrint(" Order Type = " & sType)
    r=oScript.DebugPrint(" User = " & oSession.UserCode)
    if sType = "D" Then
    r=oScript.DebugPrint(" Triggering D logic")
    retVal = oScript.SetUIControl("UDF_TEXT2_DELIVERY_DATE$", "HIDE")
    retVal = oScript.SetUIControl("UDF_TEXT2_SHIP_DATE$", "HIDE")
    retVal = oScript.SetUIControl("UDF_TEXT_DELIVERY_DATE$", "HIDE")
    retVal = oScript.SetUIControl("UDF_TEXT_SHIP_DATE$", "HIDE")
    End If
    if sType = "S" Then
    r=oScript.DebugPrint(" Triggering S logic")
    retVal = oScript.SetUIControl("UDF_TEXT_DELIVERY_DATE$", "HIDE")
    retVal = oScript.SetUIControl("UDF_TEXT_SHIP_DATE$", "HIDE")
    retVal = oScript.SetUIControl("UDF_TEXT2_DELIVERY_DATE$", "HIDE")
    retVal = oScript.SetUIControl("UDF_TEXT2_SHIP_DATE$", "HIDE")
    End If

    As I flip the Order Type field, its seeing it & triggering the script, but all 4 fields just stay as show. 

    I went back to SO & it works, as designed. As I change the order type, fields show/hide.

    I've reset the panel. Updated panels. 

    I have it firing on post-read, column pre-validate, & on panel post-load. 

    Any thoughts or suggestions on what I am overlooking? Thx!



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