Form - OnDeleteRecord Trigger
Dneal
Member Posts: 103
Hi all,
I seem to be stuck on something and hoping someone can help.
I have code put in the Form-OnDeleteRecord and it runs fine.
Form.RUNMODAL(50017,REC);
The purpose is so when the user deletes a CODE in a record they must choose a new CODE to replace it. They have duplicate Ship-to Address codes.
So when the form runs from the OnDeleteRecord and the user chooses CANCEL the record gets delete. I have the updating code sitting in the OK button.
I tried to use:
IF FORM.RUNMODAL(50017,REC) = ACTION::CANCEL THEN
EXIT;
However this doesn't stop the record from getting deleted. Does anyone know how I can program this properly?
I hope this is clear, any help would be appreciated.
Thank you,
Dneal
I seem to be stuck on something and hoping someone can help.
I have code put in the Form-OnDeleteRecord and it runs fine.
Form.RUNMODAL(50017,REC);
The purpose is so when the user deletes a CODE in a record they must choose a new CODE to replace it. They have duplicate Ship-to Address codes.
So when the form runs from the OnDeleteRecord and the user chooses CANCEL the record gets delete. I have the updating code sitting in the OK button.
I tried to use:
IF FORM.RUNMODAL(50017,REC) = ACTION::CANCEL THEN
EXIT;
However this doesn't stop the record from getting deleted. Does anyone know how I can program this properly?
I hope this is clear, any help would be appreciated.
Thank you,
Dneal
0
Comments
-
Use EXIT(FALSE);
However, prompting for user input within a transaction is very bad idea.There are no bugs - only undocumented features.0 -
Dneal,
Like bbrown mentioned maybe it's a better idea to create a
- DeleteFunction on the table.
- On the form set the "DeleteAllowed" to false.
- Create Menubutton on form with DeleteFunction in AL (F4)
In this way:
-you're not interrupting a transaction
-You're not writing code on the form (In the new 5.0 client writing Business logic will probably not be possible anymore)
- You can call the deletefunction from several forms or the deletetrigger on the table
K.Dynamics Rules!0 -
Thank you both for your help. I will be using both suggestions.
Dneal0 -
At the moment of the RUNMODAL of the form, the user is NOT in a transaction, because if he is in a transaction, Navision would give an error with a VERY big message.bbrown wrote:Use EXIT(FALSE);
However, prompting for user input within a transaction is very bad idea.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 333 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 991 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