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?
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.
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.
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.
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!
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.
Comments
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
OnRename()
ERROR(Text001,TABLECAPTION);
IF [your condition] THEN
ERROR();
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.
http://www.BiloBeauty.com
http://www.autismspeaks.org
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.
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.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Yep.