Restricting Record Renaming

Hi Guys, The scenario is User X is authorized to edit the item card and when he is creating items he accidentally changes the item no. of an item that is a BOM Component. I need to stop this from happening. I know Dynamics NAV basically won’t allow deletion of such items. However the system does allow you to rename the item no. and it updates the related tables. I need to make sure that items that are BOM components are not allowed to be changed. I did find the piece of code used by the current system to stop the item deletion and used it in the OnModify trigger of the item table to stop the modifications of BOM components. The system does pop up a confirmation when changing the item no. But that restriction is not enough. I need to make it 100% sure that even authorized users are not able to change the item no of items that are BOM components.

In the item table there is a RENAME trigger.
This is where you would put your code.
What we’ve done is add a field to the Inventory Setup called “Block Rename Of Item No.” Type Boolean.
Then we’ve added to the rename trigger of the item table the following:

IF InvtSetup.“Block Rename of Item Number” THEN
ERROR(‘You are not allowed to rename Items’);

using the ERROR message will stop changes in it’s tracks.

and if only authorized people are allowed to access the setup form’s then you’re safe.

Using the boolean we can turn it off if the very very very rare occasion comes that we want to rename an item.
Personally I lean towards NEVER - But they say never say never that’s why we did it this way.

You can do something similar on this trigger for your solution.
if item number is bom item then error type of code.

Note: we’ve added this to the Purchase & Payable setup for Vendor No’s & Sales & Receivables for Customer No’s too.


You may disable the create and the update to that user, and only give him a read permission to your form.

the next step is to create class which open a dialog where you can put in your value and press “OK” to create a new record.

then put the item menu of that class in the form.

the beauty of this way is that you don’t have to overwrite the stranded form, or at least minimize the changes.

so as a result you will have a form with a read only privileges and a button for the creation case.

I hope this will help you.

The post states that the user IS authorized to make changes to the item - just don’t change the item number if it’s part of a bom

If this is the case some code on the rename trigger on the item table IMHO is the simplest way.

Hi Savatage,

It is really good to see someone with your expertise to discuss with.

Anyhow, I always think that ya coding is “easiest way” to solve problem,

but as you know the coding solution is “hard coded” and it will be developer oriented,

but in other hand, if you solve problems by administration tool, it will not be fixed and it is not developer oriented.

what I say for short term yes coding will safe time, but for long term it may cause problem.

specially if you overwrite form and reports used by multi employee/department.


Thanx Savatage the solution worked…[:D]