Column PreValidation & reverting user entry

Hi guys, 

To interactively approve or cancel an entered value by a user, is there a way to make it work just in PreValidation event?  I'm working in SO_SalesOrderHeader

The basic logic flow is as follows

  1. User enters a value in a ShipVia
  2. Script checks values in UDFs in the same table
  3. If a criteria is met, prompt a custom message box for user to reject or accept the entry
    1. reject - the original value is retained
    2. accept - new value overrides the original value

Or for this to work, do I need to put the original value in a storage at pre-validate, then do the rest of checking/value update process in post-validate?

Ken

  • 0

    On a "pre" event (like column Pre-Validate) you can reject the event (i.e. column value change being allowed) with a SetError.  There's no need to keep the previous value, as Sage will take care of that.

    Some default settings will bypass such an event for fields like ShipVia, which is harder to deal with.

  • 0 in reply to Kevin M

    Ah, thanks Kevin!  

    Just to leave a helpful info out here for others.   You made me realize I had to get a child handle for the criteria I was using.  The script was working well except the section that dealt with a GetChildHandle through ShipVia.   I had a handle of it, but I couldn't get the record back.  Evidently I needed to issue Find() to put it in the right record.   I find working with Child handle can be such a headache.  

    Below works without following up with Find() after GetChildHandle

    Set oCust = oBusObj.AsObject(oBusObj.GetChildHandle("CustomerNo"))
    retval = oCust.GetValue("UDF_SomeUDF$",sVar)

    But below doesn't work if i took out Find()

    Set oShip = oBusObj.AsObject(oBusObj.GetChildHandle("ShipVia"))
    retval = oShip.find(sShipVia)
    retval = oShip.GetValue("UDF_SomeUDF$",sVar)

  • 0 in reply to msgking

    A ReadAdditional can help with that sometimes.

    retVal = oBusObj.ReadAdditional("ShipToCode")

    Set oShipTo = oSession.AsObject(oBusObj.GetChildHandle("ShipToCode"))