how to Sales Order Page Non Editable dynamically

I want to make the Sales order page(header) non editable for some of the users. I put a field in User Setup table and entered code in OnAfterGetRecord() to change the Page editable based On based on the value of new field in user setup table. It is not working in Sales order Page(Sales Header page )  though it is working fine in  Sales Order Subform page .

Code written under OnAfterGetRecord()  in Sales order Page is as shown below

IF (RecUserSetup."Allow Sales Order Entry" = FALSE) THEN BEGIN    


(RecUserSetup- User Setup Table ,Allow Sales order Entry - new boolen type created in User Setup table for giving user wise permission.)

Please help.