ITEM CODE should not be editable

I believed that item code should not be editable for internal control purposes. There are inventory quantity already, but i can still edit that particular item. Why is this hapenning? Is there any wrong with the set-up.

I hope someone cold help me on this.

Thank you.

Hi Morris,

You are allow to edit the item number at any time, this will rename the code in the Item table and in all other related tables. You can do one of two thing:

  1. Control through permissions (difficult to acheive)

  2. Add code to prevent renaming after ILE movements.

thanks for the quick reply. i have yet to verify this. i’ll post verification as soon as possible

Nothing to verify - Item --as well as Cust, Vend, etc, even GL Acc No-- CAN be modified, and Navision takes care to rename every reference to these in related tables.

But please keep in mind the word every - if you try to rename a heavily used Item/Cust/Vend/GLAcc code just for curiousity, you may block your DB for a couple of hours or more, while Navision updates all occurances of this code…

It is part of the inherent “flexibility” of the system. Loved by many, disliked by the few. With proper business controls in place it works fine and is a useful tool.

What I did is add a new boolean to all the setup tables item, cust, vend, etc, etc

Ie…“Block Rename of Item Number” type boolean

Item table - “No.” field trigger
OnRename()
InvtSetup.GET;
IF InvtSetup.“Block Rename of Item Number” THEN
ERROR(‘You are not allowed to rename Items’);

Then using permissions to block who can access & change the setup tables.
I hate to say “Never” but we will probably never rename item numbers and if it “has to be done” then I can uncheck the box, do what I need to do & recheck it.

thanks for all your replies and suggested solution.

savatage, i’ll try to do your suggestion.

again, thanks to all.

Hi Morris,

Try this simple resolution:

  1. Go to Tools > Object Designer
  2. Under Table select 27 Item
  3. Click Design
  4. Go to view select C/AL Globals then click Text Contants Tab
  5. Add Text Message. Example:

Name: Text025
ConstValue: You cannot rename an Item Number.

  1. Go to View > Select C/AL Code (or press F9)
  2. Type the following:

OnRename()

ERROR(Text025,TABLECAPTION);


Kindly inform me if you have any questions. Thanks.

Best Regards,

Bogz

thanks bogz. this is somewhat similar to savatage’s post, which i have to try yet. i’ll give your suggestion a shot as soon as i get back at the office.

many thanks

placing an error on rename is going to work - my version just allows you to turn it on & off from the setup table.

so you don’t have to keep editing code.

if in the future you need to allow it for whatever reason.

i like to try the one that you suggested. i think it would be more flexible if the functionality can be turned on and off. just encountered some problems and i don’t know if it has something to do with our license or maybe i’m not getting the rightand complete procedures. can you please give me a step by step flow on what to do. please bear with me beacuse i’m new with navision. thank you very much.

i like to try the solution you suggested. i think it would be better if there can really be some sort of flexibility in the functionality. i just can’t get the things done. i don’t know if that has something to do with our license or simply because my process is incomplete. can you please give me a step by step procedure on how to do it? please bear with me on this favor because i’m new in NAVISION. thank you very much.

Lets start with your license, can you write code on the triggers of the tables?

Then it’s real easy. Find the setup table you want to control the ITEM RENAME feature.
I used the Inventory setup table. I added a boolean type field and named it “Block Rename Of Item Number”
on the Setup form I added this field so I can check & uncheck it.

Then on the item table I view the c/al code. I go to the OnRename of the “No.” field and I added the code
OnRename()
InvtSetup.GET;
IF InvtSetup.“Block Rename of Item Number” THEN
ERROR(‘You are not allowed to rename Items’);

If you view the global variables there should be one referencing the setup table (record) InvtSetup-> in mycase.
if not you’ll have to add it.