Module to restrict edition of Fields

medianochemedianoche Member Posts: 2
edited 2013-05-30 in NAV Three Tier
Hi =]
I apologize for my english... and this is my sad story....


I'm doing a module [Access fields] to restrict the edition of fields through a catalog of a Code, tables, fields.
That code is assigned at a user.

For example:

- The user, has roles with permission to access at pages and edit registers of tables of the Module "Sales&Customers".
- Through the new module, I specify that this user couldn't to write in the fields: Description, Search Description and Contact of the Customer table.
- And the user has a error message when wants to edit some of those fields.


The new module [Access fields] uses variables: recordref and fieldref, to make this configuration.

The calling of this configuration is in the trigger OnModify of Customer table.


Ok, well done to this point.


When I access to the Customer table directly, and want to edit one of the these configurated fields, all works fine with the validation and error message.

Buuuut when I access to the customer Card Page, like all the users, to edit the information. I just have the error message about the restriction when I close the Page. When I accept the error message, I lose the changes of ALL fields, not just about the configurated fields.


This is because the trigger Modify of a table, is called when you move of registers or to close the page.

I did other funtion of validation and tested to put the calling it on the trigger OnValidate in each field of a Customer Table, and all works fine. But then, I'll have to put this validation in trigger OnValidate of ALL the fields of tables I want to configurate the restriction fields.

If I add new fields a table and forget to put the validation, I'll lose the funcionality of this new module.

If I put the validation in the trigger Modify of a table is minimum the code to add, and keep the funcionality for new fields.
But yes, this means to modify each object table when I want to add restriction configuration for each table. ](*,)


That's why, I put my code in the codeunit 423 [Change Log Management] because there, I have all data to made the validation [TableNumber, FieldNumber] with my catalog [Module Access Fields] and user.
For this way, I don't have to modify each object table.
I need some *extra configuration*, but all works fine, because I have the development of this new module absolutely dynamic.

Buuuut the code of Change Log Setup is called in each table after de trigger OnModify....
So, I have my error message just when I'm in a edit list and edit, or when I close a Page Card.
Not inmediatly when I edit a field [like in the trigger onValidate]


So, I need a configuration or something to forces the trigger Modify when I edit every field.
Or a miracle [-o<


=====

I tried to block field in the page, but a I need to add a boolean variable and put it in each field.... Each field, each field, each field

http://www.mibuso.com/forum/viewtopic.php?f=32&t=46587&start=0

Comments

Sign In or Register to comment.