Number Sequences in Dynamics AX are used to generate unique identifiers for master data records or transaction data records that requires identifiers. And that identifier is referred to as a reference.
Number Sequences can be alphanumeric values like 'ABC123'. So in order to maintain this alphanumeric value as a unique identifier we use number sequences to display in required manner.
step 1 : Create a new string EDT, Give the name and label as 'SampleAcNoSeq' for that edt.
step 2 : Create New Table ,drag and drop the created string edt to the table,along with new field 'city'.
step 3 : Go to Organization Administrator in client session,
common--number sequences--number sequences.
step 4 : Give the number sequence code and name , in scope parameter declare the company where it is to be saved,and in segments give the constant value as the required format in what we want to show our number sequence.
step 5 : If we want to use this number sequence in general ledger module then go to the
classes --> NumberSeqModuleLedger --> Load Module
datatype.parmDatatypeId(extendedTypeNum(SampleAcNoSeq));
datatype.parmReferenceHelp(literalStr("SampleAcNoSeq"));
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(999999);
datatype.parmSortField(10);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
step 6 : Write a job to update all the modules to synchronize the labels,edts and objects.
NumberSeqApplicationModule::loadAll( );
step 7 : Now Restart the Client and as we want to create number sequence in general ledger then go to general ledger module --> setup --> general ledger parameters --> Number Sequences
you will find the reference as our edt name and number sequence code must be given there from filter.
step 8 : Create a form and add the table which we created earlier after that drag and drop the fields to the design of the form.
step 9 : declare
NumberSeqFormHandler numberSeqFormHandler;
in class declaration and then create a new method.
step 10 : Create a Number Sequence Form Handler method(form method) and name it as 'numberSequenceFormHandler' and write the following code
NumberSeqFormHandler numberSeqFormHandler()
{
if (!numberSeqFormHandler)
numberSeqFormHandler = NumberSeqFormHandler::newForm(NumberSeqReference::findReference(extendedtypenum(SampleAcNoSeq)).NumberSequenceId,
element,
SampleNumberSequenceTable_DS,
fieldNum(SampleNumberSequenceTable,SampleAcNoSeq)
);
return numberSeqFormHandler;
}
Number Sequences can be alphanumeric values like 'ABC123'. So in order to maintain this alphanumeric value as a unique identifier we use number sequences to display in required manner.
step 1 : Create a new string EDT, Give the name and label as 'SampleAcNoSeq' for that edt.
step 2 : Create New Table ,drag and drop the created string edt to the table,along with new field 'city'.
step 3 : Go to Organization Administrator in client session,
common--number sequences--number sequences.
step 4 : Give the number sequence code and name , in scope parameter declare the company where it is to be saved,and in segments give the constant value as the required format in what we want to show our number sequence.
step 5 : If we want to use this number sequence in general ledger module then go to the
classes --> NumberSeqModuleLedger --> Load Module
datatype.parmDatatypeId(extendedTypeNum(SampleAcNoSeq));
datatype.parmReferenceHelp(literalStr("SampleAcNoSeq"));
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(999999);
datatype.parmSortField(10);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
step 6 : Write a job to update all the modules to synchronize the labels,edts and objects.
NumberSeqApplicationModule::loadAll( );
step 7 : Now Restart the Client and as we want to create number sequence in general ledger then go to general ledger module --> setup --> general ledger parameters --> Number Sequences
you will find the reference as our edt name and number sequence code must be given there from filter.
step 8 : Create a form and add the table which we created earlier after that drag and drop the fields to the design of the form.
step 9 : declare
NumberSeqFormHandler numberSeqFormHandler;
in class declaration and then create a new method.
step 10 : Create a Number Sequence Form Handler method(form method) and name it as 'numberSequenceFormHandler' and write the following code
NumberSeqFormHandler numberSeqFormHandler()
{
if (!numberSeqFormHandler)
numberSeqFormHandler = NumberSeqFormHandler::newForm(NumberSeqReference::findReference(extendedtypenum(SampleAcNoSeq)).NumberSequenceId,
element,
SampleNumberSequenceTable_DS,
fieldNum(SampleNumberSequenceTable,SampleAcNoSeq)
);
return numberSeqFormHandler;
}
step 11 : Now override the form datasource methods with
create,write,validatewrite,delete
create:
public void create(boolean _append = false)
{
element.numberSeqFormHandler().formMethodDataSourceCreatePre();
super(_append);
element.numberSeqFormHandler().formMethodDataSourceCreate();
}
write:
ttsbegin;
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
ttscommit;
validatewrite:
boolean ret;
ret = super();
ret = element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret) && ret;
return ret;
delete:
element.numberSeqFormHandler().formMethodDataSourceDelete();
super();
No comments:
Post a Comment