Object doesn't support this property or method oBusObj.EditState

Hi Everyone,

I have a simple script triggered on the Post Read event on Sales Order Header to check the edit state of the order.  The script then goes onto disable the order date and ship date fields if the edit state is 1 and the user is a member of a particular role.

This work great in sales order entry.

A problem occurs when drilling down to sales order through customer maintenance or inventory maintenance.

The first time the user drills down on a sales order it works fine; however, if the user attempts to drill down into another sales order and error 88 error is encountered. 

Any idea why it works the first time but not the second? 

Here is an excerpt from the script.

'Script to control access to certain fields on existing sales order fields.

retVal = 0
RestrictedEdit = "N"
estate=0

'retVal = oBusObj.GetValue("SalespersonNo$", slsperson)
'retVal = oScript.DebugPrint("salesperson= " & slsperson)

if oSession.CompanyCode = "TST" then    'for testing only


estate = oBusObj.EditState

retval = oSession.AsObject(oSession.UI).Messagebox("","Estate " & estate)

If cBool(oSession.AsObject(oSession.Security).IsMember("SO_RestrictEdit")) then RestrictedEdit="Y"
 ' to check to see if the user belongs to the Sales security role

If RestrictedEdit="Y" and estate = 1 then
'If RestrictedEdit="Y" then
 'Msgbox ("Restricted Edit: " & RestrictedEdit)
 'retVal = oScript.InvokeButton("fldr.pHeader")