Script to update child line

SOLVED

I wrote a script sales order detail post write script that creates a child line that is a percentage of the parent line. If the updates the parent line quantity, unit price or extension the script updates the child line, BUT does not display the change in the grid until you go to another tab, then back to the lines. I have tried using the add line function, but still does not refresh the grid line.  

'Get Values from parent line

Set oUI = oSession.AsObject(oSession.UI)

retval = oHeaderObj.getvalue("ARDivisionNo$",ARDiv)
retval = oHeaderObj.getvalue("CustomerNo$",Customerno)
retval = oBusObj.getvalue("SalesOrderNo$",SalesOrderNo)
retval = obusObj.getvalue("LineKey$",ParentLineKey)
retval = obusObj.getvalue("QuantityOrdered",Quantity)
retval = oBusObj.getvalue("UDF_TARIFF_AMT",TariffAmt)
retval = obusObj.getvalue("UDF_TARIFFLINEKEY$",ChildLineKey)

if Quantity <> 0 then UnitPrice = TariffAmt / Quantity

'Locate child line

if ChildLineKey <> "" then


retVal = oBusObj.MoveFirst()

do until cBool(oBusObj.EOF)


retval = obusObj.getvalue("LineKey$",LineKey)


'Checks if the line is the child
if Linekey = ChildLineKey then


retVal = oBusObj.SetValue("QuantityOrdered",Quantity)
retVal = oBusObj.SetValue("UnitPrice",UnitPrice)
if retval <> 1 then oui.messagebox(oBusObj.LastErrorMsg)
retVal = oBusObj.Write()

'Refresh the grid
oScript.LinesAdded = -1
oScript.LoadGrid "GD_Lines"

End if

oBusObj.movenext
loop


End if

Any help would be greatly appreciated.

Justin