Hello,
I would like to check that for example the fields "Item Category Code" and "Location Code" are not empty when going to the next record or living the item form.
With this kind of check I would like to tell the user he has forgotten to enter important information's. Of course if he enters anything the check did not help, but at least he was informed.
Is there a easy way to do that kind of check?
Thanks for your help,
Frederic
0
Comments
EXIT(CheckMandatoryFields);
Form - OnNextRecord(Steps : Integer) : Integer
IF NOT CheckMandatoryFields THEN
EXIT(0);
CheckMandatoryFields() : Boolean
EXIT(("Item Category Code" <> '') AND ("Location Code" <> ''));
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
I am here using the solution where the default value for "Blocked" is always Yes and while validating the Blocked field (if new value is Blocked=No), system checks against the fields what have to be filled (simple TESTFIELD commands).
Where do I have do declare the "CheckMandatoryFields(): Boolean"?
Is it possible to tell the user witch fields needs do bee field up?
Yes, it is, simply expand the statement
EXIT(("Item Category Code" <> '') AND ("Location Code" <> ''));
with the fields to be checked:
EXIT(("Item Category Code" <> '') AND ("Location Code" <> '') AND (MyCodeField <> '') AND (MyBoolean <> FALSE) AND (MyDecimal <> 0));
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
as soon I put the value:
Form - OnNextRecord(Steps : Integer) : Integer
IF NOT CheckMandatoryFields THEN
EXIT(0);
I can't step from one record to an other with the icon "Next" , "Previous" or "PpUp" , "PgDn" even if all fields are filled up.
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
Form - OnQueryCloseForm() : Boolean
EXIT(CheckMandatoryFields);
Form - OnNextRecord(Steps : Integer) : Integer
IF NOT CheckMandatoryFields THEN
EXIT(0);
CheckMandatoryFields() : Boolean
EXIT(("Item Category Code" <> '') AND ("Location Code" <> ''));
Could you check it with the debugger?
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
You leave the exit result uninitialized (and therefore = 0) in OnNextRecord if the added function returnes TRUE.
The correct trigger for OnNextRecord(Steps : Integer) : Integer would be
OnNextRecord(Steps : Integer) : Integer
IF NOT CheckMandatoryFields THEN
EXIT(0)
ELSE
EXIT(Steps);
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
OnNextRecord(Steps : Integer) : Integer
IF NOT CheckMandatoryFields THEN
EXIT(0)
ELSE
EXIT(Steps);
I can not step anymore in the form from one record to an other with the icon "Next" , "Previous" or "PpUp" , "PgDn" even if all fields are filled up.
Is there a solution?
I forgot the actual intended behavour of the trigger.
When the checked field is empty , I would like to have a message "Enter Category Code" when stepping to a next record. The program should stay on the actual record and not show an empty new record. How can I program this?
Thank you for your help and patience!