Hello,
just writing a little extensions for Dynamics NAV 2018.
And therefore I got the following question in that example:
I modify Name on Vendor-Table like
modify (Name)
{
trigger OnBeforeValidate();
begin
IF CONFIRM('Do you want to prevent/skip OnValidate?') THEN
// ????????? <- is there something I can call to prevent/skip the OnValidate-Trigger (Expect of ERROR or TESTFIELD)?
end;
}
I've already tried to call EXIT there, but that just leaves the OnBeforeValidate-Trigger an does not prevent OnValidate.
Do you have an idea?
Thanks
El Bartus
0
Answers
On the other hand - what's wrong with stopping update by throwing ERROR in OnBeforeValidate in this case?
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
In fact, it's nothing wrong to throw an ERROR. But that way, you are not able to change the behaviour of the Validation. Here: Search Name is set to Name.
But thanks, that helped me a lot!
Manually bound subscribes (unlike the static-automatic ones) can preserve the object vars between calls, so you could remember the old Name in some global var in OnBeforeValidate, and put it back in OnAfterValidate in all required places - coding restoring the value in all required places manually of course, without using the Validate trigger on the field to avoid loops.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!