This should do the trick on a header post write event. The weird thing is that it was necessary to use CommitLines AND SetCurrentKey during the post write, if i used the SetKey or SetCurrentKey without CommitLines before it, i got weird errors/behavior. In my humble opinion, this seems like a bug as i would expect that during a post write event, the lines have already been committed but that didn't appear to be the case.
Perhaps @AlnoorCassim might be able to provide some insight.
```
sSalesOrderNo = """" : oBusObj.GetValue ""SalesOrderNo$"", sSalesOrderNo
oScript.DebugPrint ""oBusObj.CommitLines(): "" & oBusObj.CommitLines()
oScript.DebugPrint ""oBusObj.SetCurrentKey(): "" & oBusObj.SetCurrentKey (sSalesOrderNo)
nTaxDetail = oSession.GetObject(""SO_SalesOrderTaxDetail_bus"")
If nTaxDetail > 0 Then
Set oTaxDetail = oSession.AsObject(nTaxDetail)
oTaxDetail.SetBrowseFilter sSalesOrderNo
oTaxDetail.MoveFirst
If Not(CBool(oTaxDetail.EoF)) Then
Do Until CBool(oTaxDetail.EoF)
oScript.DebugPrint ""oTaxDetail.GetKeyPadded(): "" & oTaxDetail.GetKeyPadded()
oTaxDetail.MoveNext
Loop
End If
oTaxDetail.SetBrowseFilter """"
Set oTaxDetail = Nothing
Else
oSession.AsObject(oSession.UI).MessageBox """", ""Unable to get handle to Tax Detail object"" & vbCrLf & ""Error: "" & oSession.LastErrorMsg
End If
nLines = oBusObj.Lines
oScript.DebugPrint ""oBusObj.Lines: "" & nLines
If nLines > 0 Then
Set oLines = oSession.AsObject(nLines)
oLines.MoveFirst
If Not(CBool(oLines.EoF)) Then
Do Until CBool(oLines.EoF)
oScript.DebugPrint ""oLines.EditState: "" & oLines.EditState
oScript.DebugPrint ""oLines.GetKeyPadded(): "" & oLines.GetKeyPadded()
sCommentText = """" : oLines.GetValue ""CommentText$"", sCommentText
oScript.DebugPrint ""oLines.SetValue(): "" & oLines.SetValue (""CommentText$"", sCommentText & "" Updated during Post Write"")
oScript.DebugPrint ""oLines.Write(): "" & oLines.Write()
oLines.MoveNext
Loop
End If
Set oLines = Nothing
End If
oScript.DeactivateProcedure ""PostWrite""
oScript.DebugPrint ""oBusObj.Write(): "" & oBusObj.Write()
oScript.ActivateProcedure ""PostWrite""
```