Error 88 (script) related to oHeaderObj.EditState

Solved

Confirmed in v2023 Premium and v2023 Standard (both 32-bit).

  • Have a SO Detail script, pre-write, that checks the status of oHeaderObj.EditState (...only wanting to run the line script for new orders).
  • Click to run an unrelated button script in SO Entry that loops through lines, making line field edits with a Write.  (Which works fine, the first time).
  • Accept or Cancel, then open another SO without closing the SO Entry panel, click to run the same button script and get the error.
  • Reopen SO Entry and it works the first time, then errors on the second.

Minimal scripts used in testing 

SO Detail pre-write:

' check the edit state of the order using oHeaderObj
if oHeaderObj.EditState <> 2 then ' not a new order
    exit Sub
end if

Button script:

' loop through lines and change something... to trigger the detail pre-write event
Set oLines = oSession.AsObject(oBusObj.Lines)
retVal = oLines.MoveFirst()
do until oLines.EoF
    retVal = oLines.SetValue("CommentText$", "Test")
    retVal = oLines.Write()
    retVal = oLines.MoveNext()
loop ' oLines

Everything works fine the first time, so I don't think the problem is something I have any control over, but if there is, hints would be appreciated.  I tried to oScript.DeactivateProcedure(*ALL*) in the button script (before the Write) but it doesn't seem to affect scripts in the oLines object.

Parents Reply Children