Disable RENAME

dabeldabel Member Posts: 44
Is it possible to disable the RENAME process? This has become a training issue that will not stick and client just wants it disabled.

Comments

  • krikikriki Member, Moderator Posts: 9,110
    The only way I found is to put in the OnRename-trigger of each table an error.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • bbrownbbrown Member Posts: 3,268
    Just put an ERROR statement in the tables' RENAME Trigger. See table 5405 "Production Order" as an example.



    OnRename()
    ERROR(Text001,TABLECAPTION);
    There are no bugs - only undocumented features.
  • dabeldabel Member Posts: 44
    Thank you! Worked like a charm. I was trying to error this out based on certain conditions in the lines of the document, but it appeard to be just skipping that logic. This all or nothing logic will work but I wonder, does ERROR have to be the first line of code in the trigger for this to work?
  • bbrownbbrown Member Posts: 3,268
    No, it does not. You could embed it in a condition statement.

    IF [your condition] THEN
    ERROR();
    There are no bugs - only undocumented features.
  • SavatageSavatage Member Posts: 7,142
    What we did is add a field to the setup tables of Item, Customer, Vendor etc.
    To disable RENAME but allow it if necessary without keep changing the code..

    example
    ON the Inventory setup table add a boolean called: "Disable Rename"
    On Item Table...
    OnRename()
    InvtSetup.GET;

    IF InvtSetup."Disable Rename" THEN
    ERROR('You are not allowed to rename Items');

    You can do this for the other main tables too.
    Plus it simply lets you uncheck the field to reactivate rename if you need to.
  • bbrownbbrown Member Posts: 3,268
    Savatage wrote:
    What we did is add a field to the setup tables of Item, Customer, Vendor etc.
    To disable RENAME but allow it if necessary without keep changing the code..

    example
    ON the Inventory setup table add a boolean called: "Disable Rename"
    On Item Table...
    OnRename()
    InvtSetup.GET;

    IF InvtSetup."Disable Rename" THEN
    ERROR('You are not allowed to rename Items');

    You can do this for the other main tables too.
    Plus it simply lets you uncheck the field to reactivate rename if you need to.

    Interesting and useful approach.

    We did something similar thru the use of a single instance codeunit. We created 2 functions (SetAllowRename & IsRenameAllowed). These can be set in various ways (let your imagination wander). One place, I've used this, is a function that allows a supervisor to re-open a finished production order to adjust consumption or output.
    There are no bugs - only undocumented features.
  • canadian_baconcanadian_bacon Member Posts: 91
    Comment out the existing code and write one line of code to OnGlobalRename function in codeunit 1: "ERROR('Renaming is not allowed.');".
    Enable change log and select the fields which make up the primary key of any table you want to control in the log modification column.

    This method allows you to select the tables where you want to prevent renaming without having to modify the actual table itself and having to recompile. This is of course assuming that you aren't already using the change log feature to capture modifications to these tables.
  • krikikriki Member, Moderator Posts: 9,110
    Comment out the existing code and write one line of code to OnGlobalRename function in codeunit 1: "ERROR('Renaming is not allowed.');".
    Enable change log and select the fields which make up the primary key of any table you want to control in the log modification column.

    This method allows you to select the tables where you want to prevent renaming without having to modify the actual table itself and having to recompile. This is of course assuming that you aren't already using the change log feature to capture modifications to these tables.
    And it assumes your customer has the granule for the change log.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • canadian_baconcanadian_bacon Member Posts: 91
    kriki wrote:
    Comment out the existing code and write one line of code to OnGlobalRename function in codeunit 1: "ERROR('Renaming is not allowed.');".
    Enable change log and select the fields which make up the primary key of any table you want to control in the log modification column.

    This method allows you to select the tables where you want to prevent renaming without having to modify the actual table itself and having to recompile. This is of course assuming that you aren't already using the change log feature to capture modifications to these tables.
    And it assumes your customer has the granule for the change log.

    Yep.
Sign In or Register to comment.