CurrPage.SAVERECORD error
veerendra
Member Posts: 66
Hi,
Please read the http://www.mibuso.com/forum/viewtopic.php?f=23&t=13592&start=0 post. The same code is working in the forms but I added same code in page OnValidate but it is giving me an error "The Sales Line already exist. Identification fields and values: Document Type='Order', Document No.='xxxx',Line No.='10000'
No. OnValidate()
CurrPage.SAVERECORD;
MESSAGE('%1',"Line No.");
Is that means SAVERECORD will not work if the record is not inserted completely?
#-o
Please read the http://www.mibuso.com/forum/viewtopic.php?f=23&t=13592&start=0 post. The same code is working in the forms but I added same code in page OnValidate but it is giving me an error "The Sales Line already exist. Identification fields and values: Document Type='Order', Document No.='xxxx',Line No.='10000'
No. OnValidate()
CurrPage.SAVERECORD;
MESSAGE('%1',"Line No.");
Is that means SAVERECORD will not work if the record is not inserted completely?
#-o
Veerendra Ch.
http://midynav.blogspot.com/ (Microsoft Dynamics Navision)
http://midynav.blogspot.com/ (Microsoft Dynamics Navision)
0
Comments
-
Have you tried to put the code in the OnAfterValidate-trigger?
The OnValidate-trigger serves to check if the input is valid.
The OnAfterValidate-trigger is more for saving some info.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Am I right in assuming that you have changed the code in the No. - OnValidate trigger in Page 46 - Sales Order Subform.
I have tried this out in the SP1 standard application - and I do not see the behavior you are describing.
Do you have code in the OnInsertRecord trigger on the page (which will get called by the SAVERECORD? It would be interesting to know what the value of the line no. field is in that trigger.
Did you change the AutoSplitKey, DelayedInsert or MultipleNewLines properties?Best regards,
Jens Møller-Pedersen [MSFT]
This posting is provided 'AS IS' with no warranties, and confers no rights.0 -
I had this issue as well. A SAVERECORD that seemed standard NAV 2009 triggered an error when the moment when an INSERT would occur automatically. Now, in my opinion, this is a bug. When the record is already saved in this way, the client/service should be aware of that and do a MODIFY instead. Consistent with the behavior of the Classic runtime. It's this behavior that prevents the construction of a fake "OnAfterInsert" trigger in a Table Object:
OnInsert()
BEGIN
//some code here
INSERT;
//some code here that can calculate things like a total on a parent record as if the current record was already inserted (because.. it is)
DELETE; //needed to prevent a duplicate key error
END
The above worked in the Classic runtime. Doesn't work in RTC runtime.
However, the situation being what it is, as Jens suggested I checked DelayedInsert. It was "Yes". Setting it to "No" caused the record to already be inserted before the trigger that does SAVERECORD goes off. So the SAVERECORD does a MODIFY instead of an INSERT --> issue avoided.
--> This is a workaround, not a fix
I hope MS fixes this in a future release (and adds a real "OnAfterInsert" trigger on record level
) Senior Technical Consultant at Edan Business Solutions/Sphinx IT
Owner of V-Kwadraat (see my blog about Programming and my feed about Gaming!)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
- 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