Cancelling newly entered record on the form
Cem_Karaer
Member Posts: 281
Hi all,
I have a list form based on a table (TableA) with PK consisting of three fields. The list form's DelayedInsert property is true. One of the PK fields is hidden and filled by the virtue of RunFormLink property of its caller form (i.e. users get that form via other card form that is based on a table (TableB) that has a table related field {related to TableA}; forgive me for my unsufficient English
). Users fills the second and third PK fields. But there must be a control while entering the third PK field. When the control fails, the user is confirmed whether to keep on. If the user refuses, then he/she himself/herself has to push the Esc key to clear out the third PK field and then push the F4 key to clear out the second PK field. If he/she doesn't push the Esc key then the confirmation is asked again. If he/she pushes the Esc key but not the F4 key then the first and second PK field is filled and the record is created with the third PK field empty.
I don't want to make the user to remember several keystores so I want to cancel out all the job he/she did by using code and returning him/her to his/her (
insufficient English) initial state. I tried clearing the record variable, going to the last record, reseting the record variable and other fantastic things but none of them worked! Should this code be written in the form or table? (I would prefer the table option)
I have a list form based on a table (TableA) with PK consisting of three fields. The list form's DelayedInsert property is true. One of the PK fields is hidden and filled by the virtue of RunFormLink property of its caller form (i.e. users get that form via other card form that is based on a table (TableB) that has a table related field {related to TableA}; forgive me for my unsufficient English
I don't want to make the user to remember several keystores so I want to cancel out all the job he/she did by using code and returning him/her to his/her (
Cem Karaer @ Pargesoft
Dynamics NAV Developer since 2005
Dynamics NAV Developer since 2005
0
Comments
-
You need to prevent the user to create the record with empty 3rd PK field - what about TESTFIELD(Field3) in the OnInsert trigger of the table?
In this case, the user will not be able to create the record and will be forced to enter correct value or delete the record he/she started to create. This will be easiest way, other ways will be more complicated and non-standard.0 -
Using TESTFIELD is ok. I even used it! But the real problem is to make the program do in code what the user does when he/she hits F4 key.Cem Karaer @ Pargesoft
Dynamics NAV Developer since 20050 -
You cannot do it easilly, because if there is error, you cannot react to this error by some code... Just learn the users to how to do it, it will be cheaper and application-wide and workng on 100%, than making some customization working on 80% correctly and only on one point in the application. You can make things to prevent users to get into this situations by helping them to select the correct value etc.0
-
Ok then users should be able learn how to use it. Thank you KineCem Karaer @ Pargesoft
Dynamics NAV Developer since 20050 -
i recall reading a thread on here about using sendkeys and using that thread to do something similar in my system for a stand-alone little mod we added.
you can basically programmatically send a F4 and Yes (to confirm) to NAV if a condition is met, effectively duplicating what happens when the user hits that key to delete a record - of course, i think the new version of NAV changed hotkeys, so you'd have to deal with that during upgrades (is the sendkey you programmed still doing what you want it to do).
it sounds like in your situation, though, training may be the best approach.kind of fell into this...0 -
Yes, you can use sendkeys, but the problem is that you need to use them "after" some error happend, and this is the base problem, you cannot react to some error with some C/AL code... 8)0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

