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
Comments
The OnValidate-trigger serves to check if the input is valid.
The OnAfterValidate-trigger is more for saving some info.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
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?
Jens Møller-Pedersen [MSFT]
This posting is provided 'AS IS' with no warranties, and confers no rights.
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 )
Owner of V-Kwadraat (see my blog about Programming and my feed about Gaming!)