Nav 2013 - Validate a record for fields

kjboloe
Member Posts: 56
Hi
I would like to validate that some fields is modified when the user want to update the record.
I have made corrections in the OnModify for table Job Journal Line.
TESTFIELD(Description);
When I try to insert a new record in the Job Journal and I don't update the field, I get an error that Description must be entered, when I then try to modify the field, I get an error that the uniq keys is wrong. I seens like it has thrown the connection to the record, when I trow an error.
I have tried to move the code to the page trigger, but without any result ](*,) .
Hope that someone can help me :-)
I would like to validate that some fields is modified when the user want to update the record.
I have made corrections in the OnModify for table Job Journal Line.
TESTFIELD(Description);
When I try to insert a new record in the Job Journal and I don't update the field, I get an error that Description must be entered, when I then try to modify the field, I get an error that the uniq keys is wrong. I seens like it has thrown the connection to the record, when I trow an error.
I have tried to move the code to the page trigger, but without any result ](*,) .
Hope that someone can help me :-)
Kind regards
Kenneth Jarlshøi Bolø
Dynateam A/S
Kenneth Jarlshøi Bolø
Dynateam A/S
0
Comments
-
Hi, the error I get is this in danish :
Feltet kan ikke valideres, fordi nøglefelter er ugyldige. :?
Best Regards,
KennethKind regards
Kenneth Jarlshøi Bolø
Dynateam A/S0 -
Hi, I have tried to change the code in a standard.
In Table 210, in the OnModify trigger :
OnModify()
IF (Type = Type::Item) AND (xRec.Type = Type::Item) THEN
ReserveJobJnlLine.VerifyChange(Rec,xRec)
ELSE
IF (Type <> Type::Item) AND (xRec.Type = Type::Item) THEN
ReserveJobJnlLine.DeleteLine(xRec);
// This is my code :
TESTFIELD(Description);
When I insert a record without a description, I get an error :
"Description must have a value in Job Journal Line: Journal Template Name = SAGER, Journal Batch Name=STANDARD, Line No.=190000. It cannot be zero or empty."
Then I update the field, but I can't do that ](*,)Kind regards
Kenneth Jarlshøi Bolø
Dynateam A/S0 -
If I try to delete the record I get this error :
"Delete cannot be performed since it has a key error."
Please help, I think that I have to contact Microsoft. :roll:Kind regards
Kenneth Jarlshøi Bolø
Dynateam A/S0 -
kjboloe wrote:Hi, I have tried to change the code in a standard.
In Table 210, in the OnModify trigger :
OnModify()
IF (Type = Type::Item) AND (xRec.Type = Type::Item) THEN
ReserveJobJnlLine.VerifyChange(Rec,xRec)
ELSE
IF (Type <> Type::Item) AND (xRec.Type = Type::Item) THEN
ReserveJobJnlLine.DeleteLine(xRec);
// This is my code :
TESTFIELD(Description);
When I insert a record without a description, I get an error :
"Description must have a value in Job Journal Line: Journal Template Name = SAGER, Journal Batch Name=STANDARD, Line No.=190000. It cannot be zero or empty."
Then I update the field, but I can't do that ](*,)
The error states that Description value is missing...
When you dont provide TESTFIELD with the second argument, then the value is checked for not being empty.
http://msdn.microsoft.com/en-us/library/dd301274.aspx
But consider stepping back from what you're doing, and do some studying and training before proceding further.
As a partner you have access to all the training material, even instuctor material on partnersource :thumbsup:Best regards / Venlig hilsen
Johannes Sebastian
MB7-840,MB7-8410 -
Hi, I if fill the field with a value, I don't get any errors.
If have tried to change the code to :
IF Description = '' then
error('Description must be entered');
But with same result.
The problem is not the check, but the possibility to change the data after the error.Kind regards
Kenneth Jarlshøi Bolø
Dynateam A/S0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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