Runtime Error when RecordRef trying to get missing RecordID
sunmorningindia
Member Posts: 65
1.Create a Table like:
Field No. Field Name Data Type
1 Entry No. Integer
2 Rec ID RecordID
2.Add the following values:
Entry No. Rec ID
1 Table20000
Note: Table 20000 not exists.
3.Create a Codeunit and add the following code on OnRun() trigger :
TestRecordID.GET(1);
IF RecRef.GET(TestRecordID."Rec ID") THEN
MESSAGE('Pass')
ELSE
MESSAGE('Fail');
Output :
TableData 20000 does not exist.
Expected:
Fail
I put this example for an open discussion.
Post your valuable suggestion.
Field No. Field Name Data Type
1 Entry No. Integer
2 Rec ID RecordID
2.Add the following values:
Entry No. Rec ID
1 Table20000
Note: Table 20000 not exists.
3.Create a Codeunit and add the following code on OnRun() trigger :
TestRecordID.GET(1);
IF RecRef.GET(TestRecordID."Rec ID") THEN
MESSAGE('Pass')
ELSE
MESSAGE('Fail');
Output :
TableData 20000 does not exist.
Expected:
Fail
I put this example for an open discussion.
Post your valuable suggestion.
0
Comments
-
- Your RecordID is not valid, the primary key value is missing. I wonder why NAV accepts it. This, however, does not take any effect on the issue brought before the community. I mention this here because, if you do try to add a primary key value in order to create a fully specified RecordID, nav gives an error on editing or EVALUATEing the RecordID. If the RecordID was valid once, with the primary key beeing blank, then the table was deleted or renumbered, NAV does not show the primary key value, just as in your example.
- I agree. I would expect the same result as you do. Moreover there is no easy way to overcome this. You probably will have to search one of the Object virtual tables for the table or TableData with RecID.NUMBER as it's object number where RecID is a variable set to the value of TestRecordID."Rec ID"
0
Categories
- All Categories
- 75 General
- 75 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
