Can I do that? So users don't acidentally delete a record...
Michael and Stephen have already largely answered your question. But I wanted to clarify: You don't write a script to define a Custom Menu. You get to it through Tools > Custom Menus.
Then, you define the default menu set for a given layout under the Layout Settings option in Layout mode (Layout > Layout Settings).
The most obvious way is to install a custom menu when that layout loads. Said custom menu should disable the "Delete Record" command.
A more robust way would be to constrain those users to disallow record deletion inside the security model. That would obviate the need to install a custom menu should you ever create a new layout for those users.
Thanks for your reply, Mike.
Your first soloution, creating a Script that makes a custom menu without the delete option, Triggered by the loading of a particular layout (do I have that right?) - Will that also eliminate the CNTR-E short cut to delete a record? And what about the Toolbar? We are using a File stored on a server (Datatrium) and everyone using the file has their own Toolbar, usually with a Delete Record icon.
I'm not sure what your second solution is - what is a 'Security Model'?
Jumping in here in case you need an answer before Mike Mitchell gets back regarding your question on his reply. I apologize if the explanation below is too basic.
Whenever you set up a new User with the ability to access your database, that person must assigned to a Privilege Set. When you first start creating a database, you are by default given Full Access. However, it is not a good idea to let other Users access at this level as they can change layouts, scripts, or do any other thing you can do. So, you will want create new Privlvege Sets that don't allow users to do certain things, such as modify layouts, export recotds, print, etc. . Working with these options, you can create a Privilege Set that does not have the ability to delete records. Assign anyone you don't want to delete records to this set and your problem is solved.
You access these controls from File > Manage > Security. When there, click on the Privilege Sets tab > New button to create and define your sets.
Regarding the Custom Menu question and the toolbar icons:
If you redefine the standard Delete Record command in the custom menu you can set its keyboard shortcut as well, and the shortcut and icon will then perform your script.
This works most reliably if you create a copy of the standard Record menu and modify that copy to perform a script. If you build your own custom menu from the ground up this is harder to achieve reliably, though removing the delete record command from you own menu should keep both the toolbar icon and standard shortcut from being used (unless they are still in some other part of the menu).
Thanks everyone for the responses! I am going with the custom menu, simply taking the delete and duplicate records menu commands out in a custom menu, and choosing that menu set in the Layout Setup. But I also now know how to use custom menus with priviledge sets.
Retrieving data ...