Column Post Validate Event Trigger Issue

SOLVED

Hello Sage Community,


I am having an issue with a Column Post-Validate event on the Sales Order Detail screen that I'm hoping someone can help me with.

My goal is to have a user-defined script execute on on the Column Post-Validate event of the "PriceLevel" field on the Sales Order Detail screen. The interesting problem I am having is that despite setting up the script to run on the aforementioned event, it instead runs whenever ANY field is modified, rather than just the Price Level field. Another interesting twist, is this problem only occurs if the PriceLevel field is blank. If there is a value assigned to PriceLevel, then the script runs as intended. For most of our orders, we leave the PriceLevel blank so that items default to our standard unit prices. Because of this, my UDS is running when it shouldn't be an I can't come up with an explanation as to why. We only want the UDS to execute when PriceLevel is actually edited.


If anyone can shed some light and offer some advice for this issue, it'd be greatly appreciated.

Thanks in advance!

Brad

Parents
  • 0

    I can't shed any light on why it is running when it is not supposed. Just to hazzard a guess, it might have to do with an null value vs. and empty string.

    My suggestion would be to add an if statement to your script and if the price level is nothing or empty, then exit the script, otherwise continue processing the script. (In case you didn't know it already, the variable `value` is assigned the colum value in column post-validate scripts.)

    Example:

    If value = "" Then

       Exit Sub

    End If

    ' handle price code here

  • 0 in reply to dlech

    Dlech,

    Thanks for the response. I would agree this could work, however there are cases where we would update the price level from a value, too nothing. For example, the current value could be "E" and the user may update it to "". In this case I would want it fire off my price code logic.

    I would like to do something similiar, check to see if the value is edited with something like;

    If PriceLevel.current <> PriceLevel.proposed Then

      'execute logic

    End If

    But I'm not sure on how this can be done in an UDS. Any thoughts?

  • 0 in reply to BPettry
    verified answer

    In that case, I would suggest using oScript.SetStorageVar to hold the previous value. You will need to add a script the the table post-read event to get the initial value. Something like...

    PriceLevel = ""

    oBusObj.GetValue("PriceLevel$", PriceLevel)

    oScript.SetStorageVar("PrevPriceLevel", PriceLevel)

    Then to retreive that value in your existing script...

    PrevPriceLevel = ""

    oScript.GetStorageVar("PrevPriceLevel")

    And at the end, add a line to update PrevPriceLevel...

    oScript.SetStorageVar("PrevPriceLevel", value)

  • 0 in reply to dlech

    Thanks dlech! This sounds like a very reasonable solution. I'll give it a shot and let you know how it works out for me.

Reply Children