Topic : Create number sequence in d365 using x++.
In this post I created a new number sequence for my existing module. Just follow the below steps.
1. Create a new extension class for NumberSeqModuleMyModule. written the below code in loadModule method.
2. Create a new extension class for parameter table(MyParmeters) and a new method.
[ExtensionOf(tableStr(MyParameters))] final class MyParameters_Extension { public static NumberSequenceReference myId() { return NumberSeqReference::findReference(extendedTypeNum(MyId)); } }
3. To run the NumberSeq class just create a job(runnable class).
class RunnableClass
{ public static void main(Args _args) { NumberSeqModuleMyModule loadModule = new NumberSeqModuleMyModule(); ; loadModule.load(); } }4. run the runnable class and then go to Organization administration –> Number sequences –> Number sequences –> Generate Button (Run the wizard).
5. To test that number seq follow the below code.
class RunnableClass { public static void main(Args _args) { NumberSeq numberSeq; str num; ; numberSeq = NumberSeq::newGetNum(MyParameter::MyID()); num = numberSeq.num(); info(num); } }
Keep daxing!!
No comments:
Post a Comment