Able to suppress "Do you want to rename"

spider1269
Member Posts: 77
My boss would like to suppress the "Do you want to rename" pop up on a custom table. This is a standalone table but it has 4 fields as part of the primary key. Whenever any of the fields are changed the message pops up.
I've tried putting the RENAME function in the OnValidate for the fields but I'm still prompted for the rename when I change one of the primary key fields.
Thanks.
I've tried putting the RENAME function in the OnValidate for the fields but I'm still prompted for the rename when I change one of the primary key fields.
Thanks.
0
Comments
-
if the table key is frequently changed, probably you have to review the table design and change the key.
If the table key is NOT frequently changed, it's better to have that confirm message in my opinion, because maybe it is an unwanted change (that is, the user usually does not change the primary key, but creates another record, and block the old, if you have a field to block records like customers and items...).
What is your business need to change that key? i mean: why the message have to be suppressed?0 -
The table contains additional information about Item records. For a given item they may update 40-50 lines at a time and so they would have to click the rename pop-up 40-50 times. Multiply that by 5,000 items and it slows the process down considerably.
We're looking at changing the primary key but at this point it was put in place so duplicate records weren't entered.
Suppressing the pop-up is only being looked at to increase the speed of data entry. They always want to rename the record so it's kind of a useless pop-up as far as the end user is concerned.0 -
If there are no relations (property TableRelation) to this table, which seems very likely in this case, then it is possible to program your way around this. But changing the primary key could be easier.
You could make variables for the primary key fields, and use them as SourceExpr.
Then you would have to program everything (OnAfterValidate). Find the record, insert if not existing etc.
The trick here is to NOT do a rename, but to delete and insert.Keep It Simple and Stupid (KISS), but never oversimplify.0 -
also if you change the PK, you can still add validation to prevent duplicates onvalidate/ oninsert/onmodify to check uniqueness of the field and delay insert on that form.
In fact I think the issue is Delayed insert on that form. Is it enabled?0 -
Rashed,
Delayed Insert is set to no.0 -
I suggest to set it to yes,
that way the user can populate all PK and then the record get inserted and thus no rename is required until they actually change the PK.0 -
Change the primary key. This was probably a bad design from the start. Better to fix it sooner than later.David Singleton0
-
I know I don't make friends with the following suggestion but you could do this (very dirty code!) in the OnModifyTrigger of your form:
Form - OnModifyRecord() : Boolean IF NOT MODIFY(TRUE) THEN BEGIN IF xRec.DELETE THEN INSERT; EXIT(FALSE); END ELSE EXIT(TRUE);
Reijer Molenaar
Object Manager0 -
The previous is when you don't want to rename the record.
It simply deletes and inserts a record.
If you do want to rename the record you could rename the xRec in the OnModiyTrigger:Form - OnModifyRecord() : Boolean IF NOT MODIFY(TRUE) THEN BEGIN xRec.TRANSFERFIELDS(Rec, FALSE); xRec.RENAME("Your Key Field 1", "Your Key Field 2", "Your Key Field 3", "Your Key Field 4"); END; EXIT(FALSE);
Reijer Molenaar
Object Manager0 -
reijermolenaar wrote:I know I don't make friends with the following suggestion but you could do this (very dirty code!) in the OnModifyTrigger of your form:
Form - OnModifyRecord() : Boolean IF NOT MODIFY(TRUE) THEN BEGIN IF xRec.DELETE THEN INSERT; EXIT(FALSE); END ELSE EXIT(TRUE);
Second: NEVER do this type of code on the form.0 -
reijermolenaar wrote:I know I don't make friends with the following suggestion but you could do this (very dirty code!) in the OnModifyTrigger of your form:
Form - OnModifyRecord() : Boolean IF NOT MODIFY(TRUE) THEN BEGIN IF xRec.DELETE THEN INSERT; EXIT(FALSE); END ELSE EXIT(TRUE);
Thanks reijermolenaar! Great solution for form 7002 when you need to change many records' starting dates and don't want to see that silly message every time.0 -
This problem would have solved if u set the delayed insert as yes.
When u set this, it will ask only once for the entire line.
I suggest to do like this rather going for adding code in onModify Trigger.
Delete and insert will anyhow end-up with performance issue. And if multiple users are working simultaneously then you face the table locking issue.--
Regards,
Raveendran.BS0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions