Hi All,
I am trying to rename a primary key field of a table, and am running into problems. Please advice.
Scenario
I am currently working on the Default Navision Job Master table. (Jobs : 167). The client requires to auto generate the number series for the Job based on certain conditions. The conditions are
a. Job Type (Could Be Any Thing)
b. Job Level (Boolean corresponds to Parent - Child).
Please refer the Fig00101 below for more information on the field placings.
I have also created a separate table, where the Job Type - Job Level - Number Series combination would be captured. Please refer Fig00102.
Now based on the user input in these two fields, I would want to create a new number for the Job. Since Navision creates the number when the user presses F3, I would have to replace that number and show custom generated number in the field. I have written the following code to achieve that.
// Get - Set The Number Based On Job Type
IF "Job Type" = '' THEN
BEGIN
ERROR('Please select a Job Type to proceed.');
EXIT;
END
ELSE
BEGIN
IF NVJobMstr.GET("Job Type") = TRUE THEN
BEGIN
// Check Which No. Series To Get
IF "Is Child" = TRUE THEN
BEGIN
// Get The Next Number Using Child Number Series
sDocNo := NoSeriesMgt.GetNextNo(NVJobMstr."Child No. Series",0D,TRUE);
END
ELSE
BEGIN
// Get The Next Number Using Child Number Series
sDocNo := NoSeriesMgt.GetNextNo(NVJobMstr."Parent No. Series",0D,TRUE);
END;
END
ELSE
BEGIN
ERROR('A Get operation on table NV Job Type Master failed accessing data.');
EXIT;
END;
END;
// Delete Old Record From Table
IF DELETE(TRUE) = FALSE THEN
BEGIN
ERROR('A Delete operation on table Jobs failed accessing data.');
END;
// Insert New Data Into Table
"No." := sDocNo;
IF INSERT(TRUE) = FALSE THEN
BEGIN
ERROR('An Insert operation on table Jobs failed accessing data.');
END;
// Reset The Current Record
RESET;
Problem
Everything works fine. But when I try to close the window, I get a warning message saying
"Rename Record ?". Please refer Fig00103.
Throughout my code, I have not used the RENAME keyword. And I looked into MIBUSO forums from where I figured out that it is better to DELETE + INSERT than to RENAME.
http://www.mibuso.com/forum/viewtopic.php?f=14&t=16743&hilit=Rename+REcord
Please do let me know how to overcome this problem. Thanks in advance for all the help.
Comments
My Blog - nav.education
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
take two steps back and start again.
as usual, Kine was quicker.
Hi David,
Can you please explain more in detail. I am pretty new to NAV. I have been working in Dynamics GP for more than 5yrs, now slowly shifting over to NAV. It would be of great help if you can explain as to how I can create properties for job. Are we trying to create a new form or something like that, and then link that to the main job form. Please do explain.
Thanks & Best Regards
Sankaran Balasubramonian
Hi Kine,
The client has a lot of customizations done on the Job Module. So if I store if else where, I will have to extended this number across all those customizations. Please advice.
Thanks & Best Regards
Sankaran Balasubramonian