Deleting Item Codes

I am doing a modification to keep track all the items that have been deleted. The concept is once the items are deleted then the system will do TRANSFERFIELD those deleted records into another table (let’s name the table as Deleted Items). Then, I create a Form to displays all these deleted items for history purposes. Everything works fine, the problems that I am having right now: 1. When I opened the Deleted Items table (thru Object Designer), I can block and manually delete all the records in this table. How to protect this manual deletion from happening? 2. In the Form that I created, is it possible to display the deleted item code with blinking? Thank you. ZEN

Hello Zen, I assume you have a license with access to the code… well, as you are using TRANSFERFIELD then you must have this access… [Duh!] 1) simply put a ERROR(‘You may not delete this record.’) into the OnDelete trigger of your new “Deleted Items” table. 2) That’s more difficult, you’ll have to use the OnTimer trigger, together with the TimerInterval property of the form, and update that Code Field every 500 miliseconds (or so). But wouldn’t it be easier to show this field in red or bold??? That would be a simple property in the form. Saludos Nils

I do have permission to access the code. 1. I understand about the simple coding that you mentioned but what I am trying to have is the controll from the system; some kind of codeunit that probably available in Navision that can control this function. The reason why I don’t like to put it into OnDelete trigger is because of too obvious; just mark the coding and do the deletion. 2. I know it’s easier playing with color but I am just trying to do something different. Please tell me more detail on this. “Isn’t that make up can make people look prettier”…[:D] ZEN

Hello Zen, 1) actually I am not aware of any codeunit that would handle this “avoid deletion”, for me it would be either that ERROR on the OnDelete trigger or permissions - you can of course remove all Delete permissions on that table, leaving the SUPER role as the only one that could delete these records… 2) I attached a small list file on items to show the necessary code, it was easier to put together these lines, instead of trying to explain the functioning, especially check the OnFormat trigger of the “No.” field. Saludos Nils
Attachment: F50049 Blinking Field.zip ( 1807bytes )

  1. The data on that table should then be protected through permissions, not code. Exclude deletion of records in the table for everyone except SUPER users; 2) Read this [:D]: http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=12654&SearchTerms=blink

quote:

[Oops!] looks like i was reinventing the wheel… at least made it work for tabular-type forms [:)] Saludos Nils

quote:

I do have permission to access the code. 1. I understand about the simple coding that you mentioned but what I am trying to have is the controll from the system; some kind of codeunit that probably available in Navision that can control this function. The reason why I don’t like to put it into OnDelete trigger is because of too obvious; just mark the coding and do the deletion.
Originally posted by Zen Bodhi - 2006 Feb 13 : 13:52:31

Either that or just make the form not editable.

  1. Is there any other solution? For me, I want it strict (also like this case); I like the concept of whatever posted can’t be inserted, modified or deleted including SUPER USER. Actually, this protection is dedicated to the SUPERUSERS not ENDUSER. I don’t want them to run the table and accidentally delete or modify it in purpose. 2.[Oops!]…sorry .it doesn’t work out for me. Is there something that I am missing? OnTimer trigger I put: Blink := not blink; CurrForm.“No.”.visible(blink); ZEN

Set the TimerInterval property of your form to 500. Otherwise, the OnTimer trigger doesn’t get called at all. The “SUPER” user can do anything, there is no possibility, at least not one that I know of, that locks down a table completely. There is always at least the SUPER role that will be able to delete those records (if we include the option to deactivate code). Saludos Nils

I see…it’s superb!![:O)] How to stop the label from blinking? I want only the TextBox is blinking. Thank you. ZEN

delete the label and add a new label with the new caption.

Thanks. Is it the same steps if I want to blink the label instead? ZEN

…almost… as long as the label and the field are related, with the ParentControl property (the label holds the id no. of the related field), the label will follow actions you perform on the field itself (deleting and recreating the label does remove this linkage). When you want to make the label blink, instead of the field, give the label itself a unique name (e.g “NoLbl”) and modify your code: CurrForm.NoLbl.visible(blink); Saludos Nils

Thank you for the helps. You guys are rock! Have a wonderful day and keep smiling…[:)][:)]! ZEN

quote:

Have a wonderful day and keep smiling

Thanks a lot and we definitly will, with such cool feedback [Yeah!] Saludos Nils

I am apologize to raise this issue again. The question was just flashing in my mind. Let’s say I delete those inactive items that having 0 inventory and no activities for these past 2 years. Since the deletion is not erasing the ledger entry tables, then, what is going to happen if we print out detail report (back dated) that is using ledger entry tables contains those deleted item codes? ZEN

Zen, this depends a lot on the design of the reports, if they are based on “Item” as first dataitem, the “deleted” items of course won’t appear, if they are based on ledger entries, the report itself might still work, if there is no “Item.GET()” within the code, but there might be missing some fields like item description… (anyway, it is always better to use “IF Item.GET() THEN”, just in case). It’ll requiere some more information on your reports or analysis to define the implications and propose possible solutions… Saludos Nils

Thank you Nils. Will do your suggestion. ZEN

That is the reason for having code in the OnDelete Trigger of the Item table which doesn’t let you delete items where you have item ledger entries.

I got it. It’s all about the coding. Thank you guys. ZEN