Thursday, 12 July 2018

Number Sequence in D365

  1. Create new EDT
  2. Add EDT to new table and write below method at table level.
    1. static NumberSequenceReference numRefMROBulkTransferNumber()
      {
      return NumberSeqReference::findReference(extendedTypeNum(MROBulkTransferNumber));
      }
  3. write new class to extend existing module class
    1. [ExtensionOf(classStr(NumberSeqModuleMRO))]
      final class NumberSeqModuleMRO_Extension
      {protected void loadModule()
      {
      NumberSeqDatatype datatype = NumberSeqDatatype::construct();
      next loadModule(); // Execute the augmented original class method
      datatype.parmDatatypeId(extendedtypenum(MROBulkTransferNumber));
      datatype.parmReferenceHelp(literalstr(“Number for Bulk transfer”));
      datatype.parmWizardIsManual(NoYes::No);
      datatype.parmWizardIsChangeDownAllowed(NoYes::No);
      datatype.parmWizardIsChangeUpAllowed(NoYes::No);
      datatype.parmWizardLowest(1);
      datatype.parmWizardHighest(99999999);
      datatype.parmSortField(82);
      datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
      this.create(datatype);
      }}

  4. Create new Runnable class(Job)
    1. class RunnableClass_numberSeq
      {
      /// <summary>
      /// Runs the class with the specified arguments.
      /// </summary>
      /// <param name = “_args”>The specified arguments.</param>
      public static void main(Args _args)
      {NumberSeqModuleMRO numberSeqMod = new NumberSeqModuleMRO();
      numberSeqMod.load();
      }
      }
  5. To go Organization Administration -> CommonForms -> Numbersequences -> Numbersequences -> Generate -> run the wizard.
  6. Navigate to module(MRO in my case): Setup -> Project management parameters form -> Num Seq.  You will find your new numberSeq

No comments:

Post a Comment