Description: Here
I have given simple demonstration to get new worker number sequence code or
Worker personnel Number through code in ax 2012.
Code
static void getNewEmployeeId(Args _args) { HcmPersonnelNumberId hcmPersonnelNumberId; NumberSequenceReference numberSeqReferencePersonnelNum; NumberSequenceTable numberSeqTablePersonnelNum; NumberSeq numberSeqPersonnelNum; // Number Sequence numberSeqReferencePersonnelNum = NumberSeqReference::findReference(extendedTypeNum(HcmPersonnelNumberId)); numberSeqTablePersonnelNum = NumberSequenceTable::find(numberSeqReferencePersonnelNum.NumberSequenceId); if (numberSeqTablePersonnelNum) { // generate worker personnel number if number sequence code is created. numberSeqPersonnelNum = NumberSeq::newGetNumFromId(numberSeqTablePersonnelNum.RecId, true, true); if(numberSeqPersonnelNum) { hcmPersonnelNumberId = numberSeqPersonnelNum.num(); info(strFmt("%1",hcmPersonnelNumberId)); } } //return hcmPersonnelNumberId; }