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")

Parents Reply Children
  • 0 in reply to gordongraham
    This really doesn't explain it but might give a clue to a workaround.

    Description for oBusObj.EditState is:

    EditState property values (0=no record in memory; 1=Existing record; 2=New record). Useful if you only want to run logic for a new record. Read only cannot be set. (NOTE: This is also the return value of the SetKey() method.

    Seems to me that if you are drilling down from customer maintenance or inventory maintenance then your result could never be 2=new record? Therefore if you can figure out where it is being called from you could just bypass that check. Not sure how you would do that, however.