I apologise if this has been answered elsewhere in this site - I wasn’t able to find an answer through my searching.
I’m attempting to restrict access on a form. I only want to allow access to a small number of fields. I’ve put the below code (example) in OnAfterGetRecord
However, it seems that the last line is not working i.e. the Name field is still read only. I checked this with other fields In my code and I’m sure I haven’t made a type or anything.
If I switch the code logic around (just for fun) :
Yes, table properties override form properties and form properties override text box properties. Search for “editable field on uneditable form” or similar and you should find a work around using the OnActivate and OnDeactivate triggers for a text box. That or mark all of the fields one by one.
Thanks for the reply. I was able to find the other posts which you described & was able to get it working as per those.
On a related matter, prior to getting your response, I had manually set all the fields individually (in code) to .EDITABLE:=FALSE
On the Customer Card, we have the same field repeated on multiple tabs, for example the “Phone No.” appears on the General tab and Communication tab.
With the approach of setting fields to false, CurrForm.“Phone No.”.EDITABLE := FALSE; only the first occurance of that field becomes read only. The second occurance, i.e. on the communication tab, was not set to read only.
Do I need to specify a different statement to set both to read only? We have a couple of fields on different tabs for flow of information purposes.
Just an appendix: did you know that forms like 25 (Customer Ledger Entries) and 132 (Posted Sales Invoice) are editable? Each and every form-field (textbox) has property Editable=TRUE. This is standard since Navision Financials.
If you put a new field into it will be totally open. Ok, CustLedgerEntries are handled by codeunit 103, called from form-trigger OnModifyRecord, but in form 110 there no check what so ever.
In form 130 the edit will be handled, that is correct.
But forms 132 and 134 (Posted Invoice and -Credit Memo) do not have that code. Has allways been like that since at least Financials 1.30, and still remains in NAV 2009.