Prevent a user from renaming a record in certain forms

AleSlammer
Member Posts: 25
Hi
Is it possible to prevent users from renaming records in certain forms ?
I know some people will ask what reason, and some people will tell me just to throw an error message in the rename trigger of the underlying table.
The reason for doing so is that it should be a master table renaming tables where the primary key of the master table is a foreign key.
The application is integrated with a webshop, and the webshop handles the renaming of master tables, so I should only care about renaming the tables and not telling the webshop what to do(only that the master table has been renamed - in that way I don't need to put a lot of code in the rename triggers of other than master tables)
Is it possible to prevent users from renaming records in certain forms ?
I know some people will ask what reason, and some people will tell me just to throw an error message in the rename trigger of the underlying table.
The reason for doing so is that it should be a master table renaming tables where the primary key of the master table is a foreign key.
The application is integrated with a webshop, and the webshop handles the renaming of master tables, so I should only care about renaming the tables and not telling the webshop what to do(only that the master table has been renamed - in that way I don't need to put a lot of code in the rename triggers of other than master tables)
0
Comments
-
Does it use Number Series? Make the "No." field non editable??0
-
Hi Mark and thank you for your answer :-)
no the key doesn't use number series. You have to be able to insert new records in the table and define the primary keys yourself, so I don't think that's the way to go :-)0 -
What about make it editable based on the boolean condition ("No." = '')0
-
that could be the way to go...in which trigger would you put the code ?0
-
-
I tried with the following code:
IF(Category <> '') THEN
BEGIN
CurrForm.Category.EDITABLE := FALSE;
END
OnAfterGetCurrRecord trigger, but it worked a little bit too well...I can't edit the field no matter I make a new record. Am I missing your point in someway ?0 -
Put something like this in OnAfterGetCurrRecord:
CurrForm."No.".EDITABLE ("No." = '')
assuming that the Field "No." is the primary key field.
The editable property of the field on the form is true.Frank Dickschat
FD Consulting0 -
What about using the OnModifyRecord() trigger of the Form?0
-
thanks to everybody for their response. I tried everything and I found that FDickschat's solution worked. I wonder why it worked though, since the editable is allready set to true and CurrForm."No.".EDITABLE ("No." = '') shhould logically only change the field to be editable if the no=''. The thing is I would expect that you would make it not editable from No. <> '' instead of making it editable, since it is allready editable :-k0
-
AleSlammer wrote:thanks to everybody for their response. I tried everything and I found that FDickschat's solution worked. I wonder why it worked though, since the editable is allready set to true and CurrForm."No.".EDITABLE ("No." = '') shhould logically only change the field to be editable if the no=''. The thing is I would expect that you would make it not editable from No. <> '' instead of making it editable, since it is allready editable :-k
IF(Category <> '') THEN BEGIN CurrForm.Category.EDITABLE := FALSE; END ELSE BEGIN CurrForm.Category.EDITABLE := TRUE; END;
but FDicksChat solution is the perfect way: 1 line instead of 5...0 -
If you think about the "why" the solution is not so far away: The field properties (Editable, Enabled,...) are applied to the field only once at the time the form is opened. Instead of the properties you could also write one line of code in the OnOpenForm Trigger.
As the form opens usually to an existing record your line of code comes in and makes the field not editable. When you press F3 nothing happens because you have not programmed it and the property is not applied again as the form is already open.Frank Dickschat
FD Consulting0 -
FDickschat wrote:If you think about the "why" the solution is not so far away: The field properties (Editable, Enabled,...) are applied to the field only once at the time the form is opened.
Not true at all. They are applied when a new record is loaded. What if you loaded a record that caused fields to be uneditable, but then moved to another perfectly good record without closing the form? You wouldn't expect the fields to remain uneditable.0 -
matttrax wrote:FDickschat wrote:If you think about the "why" the solution is not so far away: The field properties (Editable, Enabled,...) are applied to the field only once at the time the form is opened.
Actually this thread supports my theory: You have to program both, the editable=true and the editabe=false part. If you set the property to true and only program the false part it is not working.Frank Dickschat
FD Consulting0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions