Number series are usually used for primary key fields. You need to be a little clear on what you are want to do. I'm going to assume you are going to create a new table let us call it WebUsers. The primary key of the field is No.
You need to create a field for the setup where you'll need to grab the right number series. I'm going to put a new field "WebUsers Nos." in Sales & Receivable Setup table. This field will link to number series table.
Then oninsert trigger of WebUsers I would put the following code.
NoSeriesMgt as CodeUnit NoSeriesManagement;
SalesSetup as Record Sales & Receivables Setup
IF "No." = '' THEN BEGIN
SalesSetup.GET;
SalesSetup.TESTFIELD("WebUsers Nos.");
NoSeriesMgt.InitSeries(SalesSetup."WebUsers Nos.",xRec."No. Series",0D,"No.","No. Series");
END;
and onvalidate of No. field
IF "No." <> xRec."No." THEN BEGIN
SalesSetup.GET;
NoSeriesMgt.TestManual(SalesSetup."WebUsers Nos.");
"No. Series" := '';
END;
That's it.
Ahmed Rashed Amini
Independent Consultant/Developer
May be i m wrong but I think Sridhar is asking for AssistEdit Button on which u have three dots.
Sridhar, The three dots is visible if u write a Function on OnAssistEdit Trigger. Actually it is used to provide a option to the user to select the "No. Series" manually....i mean to say when user click on this Assist Button it will open the No. Series Form and user select the No. Series form it.
Number series are usually used for primary key fields. You need to be a little clear on what you are want to do. I'm going to assume you are going to create a new table let us call it WebUsers. The primary key of the field is No.
You need to create a field for the setup where you'll need to grab the right number series. I'm going to put a new field "WebUsers Nos." in Sales & Receivable Setup table. This field will link to number series table.
Then oninsert trigger of WebUsers I would put the following code.
NoSeriesMgt as CodeUnit NoSeriesManagement;
SalesSetup as Record Sales & Receivables Setup
IF "No." = '' THEN BEGIN
SalesSetup.GET;
SalesSetup.TESTFIELD("WebUsers Nos.");
NoSeriesMgt.InitSeries(SalesSetup."WebUsers Nos.",xRec."No. Series",0D,"No.","No. Series");
END;
and onvalidate of No. field
IF "No." <> xRec."No." THEN BEGIN
SalesSetup.GET;
NoSeriesMgt.TestManual(SalesSetup."WebUsers Nos.");
"No. Series" := '';
END;
That's it.
May i know how about cases for those fields which are not primary key?
:roll: :roll: :roll:
Comments
You need to create a field for the setup where you'll need to grab the right number series. I'm going to put a new field "WebUsers Nos." in Sales & Receivable Setup table. This field will link to number series table.
Then oninsert trigger of WebUsers I would put the following code.
NoSeriesMgt as CodeUnit NoSeriesManagement;
SalesSetup as Record Sales & Receivables Setup
IF "No." = '' THEN BEGIN
SalesSetup.GET;
SalesSetup.TESTFIELD("WebUsers Nos.");
NoSeriesMgt.InitSeries(SalesSetup."WebUsers Nos.",xRec."No. Series",0D,"No.","No. Series");
END;
and onvalidate of No. field
IF "No." <> xRec."No." THEN BEGIN
SalesSetup.GET;
NoSeriesMgt.TestManual(SalesSetup."WebUsers Nos.");
"No. Series" := '';
END;
That's it.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Then how we are getting 3 dots at the end of the No. Field in the form..?
May be i m wrong but I think Sridhar is asking for AssistEdit Button on which u have three dots.
Sridhar, The three dots is visible if u write a Function on OnAssistEdit Trigger. Actually it is used to provide a option to the user to select the "No. Series" manually....i mean to say when user click on this Assist Button it will open the No. Series Form and user select the No. Series form it.
Then I m doing project related to the Financial Module. I want to know in which setup table I have to set the No. Series and how to set it..?
May i know how about cases for those fields which are not primary key?
:roll: :roll: :roll:
You have specified an unknown variable.
No. Series
Define the variable under Global C/AL Symbols?