Number Sequence in D365
Step 1: Create EDT
Step 2: Use that EDT in the Table where it
is required
Step 3: Select the Class module which you
going to implement this Number seq.
class NumberSeqModuleVehicleDetails extends NumberSeqApplicationModule
{
Protected void
loadModule()
{
NumberSeqDatatype
datatype = NumberSeqDatatype::construct();
/*
Setup application numbers */
datatype.parmDatatypeId(extendedtypenum(VehiclId)); //your EDT
datatype.parmReferenceLabel(literalstr("Mobile
id"));//your Label
datatype.parmReferenceHelp(literalstr("Mobile
id"));
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(2000);
datatype.parmWizardfetchAheadQty(10);
datatype.parmSortField(1);
datatype.addParameterType(NumberSeqParameterType::DataArea,
true, false);
this.create(datatype);
}
public NumberSeqModule
numberSeqModule()
{
return NumberSeqModule::VehicleDetails;
}
[SubscribesTo(classstr(NumberSeqGlobal),delegatestr(NumberSeqGlobal,buildModulesMapDelegate))]
static void
buildModulesMapSubsciber(Map numberSeqModuleNamesMap)
{
NumberSeqGlobal::addModuleToMap(classnum(NumberSeqModuleVehicleDetails),
numberSeqModuleNamesMap);
}
}
Step 4 :
Select the concern table. Create new methods
as below
public static client server
NumberSequenceReference numRefVehicles()
{
return NumberSeqReference::findReference(extendedTypeNum(VehiclId)); //
Your EDT
}
Step 5 :
Create a
new job with the following code and run it
public static void main(Args _args)
{
NumberSeqApplicationModule::loadAll();
info("Ok");
}
Step 6 :
- Select Organization administration-> Number
Sequence-> Number Sequence
- Select the module //here we select MobileDetails
- Select the EDT you created //Surly that EDT you
created will be appear here.
- Click GENERATE
Step 7:
public class SMJ_VehiclesDialog extends FormRun
{
NumberSeqFormHandler
numberSeqFormHandler;
}
Step 8:
NumberSeqFormHandler
numberSeqFormHandler()
{
NumberSequenceTable numberSeqTablesmj_Vehicles;
if
(!numberSeqFormHandler)
{
numberSeqTablesmj_Vehicles= NumberSeqReference::findReference(extendedTypeNum(SMJ_Vehicles)).numberSequenceTable();
if (numberSeqTablesmj_Vehicles && numberSeqTablesmj_Vehicles.Manual == NoYes::No)
{
numberSeqFormHandler = NumberSeqFormHandler::newForm(SMJ_Vehicles::numRefVehicles().NumberSequenceId,element,
SMJ_Vehicles_ds, fieldNum(SMJ_Vehicles,
Vehicle_Id) );
}
}
}
return
numberSeqFormHandler;
}
Step 9:
- Select the Form on which that table is required.
- Drop the table in to that form Data Source.
- Override the datasource methods of that table with following method in that form.
// Write method
public void write()
{
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
}
//Delete method
public void delete()
public void delete()
{
element.numberSeqFormHandler().formMethodDataSourceDelete();
super();
}
// Create method
public void create(boolean _append = false)
{
super(_append);
element.numberSeqFormHandler().formMethodDataSourceCreate();
}
Comments
Post a Comment