Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Creating a Number Sequence for Newly Created Module

(0) ShareShare
ReportReport
Posted on by 3,957

Hi,
I've created a module(Course Management System) and added Parameter Table as well Parameter Form. I've also created a two EDTs(studentId,courseId) and added the module to map. I can see the Number Sequence on the Number Sequence form as well as references as StudentId and CourseId.
In the Parameter form I've the DataSource as Parameter and NumberSequenceReference and in the grid added (referenceLabel,NumberSequenceId). But, on running the form, I'm getting one entry as shown below.

Task1.PNG

Instead the expected entries are 

ReferenceLabel SequenceCode
student id <CMS ...>
courseid <CMS ...> 

Can anyone suggest any solution?

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    RE: Creating a Number Sequence for Newly Created Module

    Have used NumberSeqReference::buildQueryRunMulti() in executeQuery() of NumberSequenceReference datasource? You can find examples in (almost) any parameters form (and on internet).

  • Olister Rumao Profile Picture
    Olister Rumao 3,957 on at
    RE: Creating a Number Sequence for Newly Created Module

    Hi André,

    I've already gone through that blog. And I can see the Reference in number sequence configuration. Also my number sequence is creating StudentId and Course ID on running 'info(NumberSeq::newGetNum(CMSParameters::numRefCMSCourseId()).num());' .I'm not able to display the reference in the number sequence tab.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,391 Super User 2024 Season 2 on at
    RE: Creating a Number Sequence for Newly Created Module

    Hi Olister,

    Did the reply from Martin help you? Or do you still have the open question. If so, please read the next blog for more help: community.dynamics.com/.../microsoft-dynamics-365-for-operations-number-sequence

  • Olister Rumao Profile Picture
    Olister Rumao 3,957 on at
    RE: Creating a Number Sequence for Newly Created Module

    I've implemented the class as follows:

    class NumberSeqModuleCMS  extends NumberSeqApplicationModule

    {

       public void initializeReference(NumberSequenceReference _reference, NumberSeqDatatype _datatype, NumberSeqScope _scope)

       {

           super(_reference, _datatype, _scope);

           switch (_datatype.parmDatatypeId())

           {

               case extendedTypeNum(CMSStudentId):

               case extendedTypeNum(CMSCourseId):

           }

       }

       public void loadModule()

       {

           NumberSeqDatatype datatype = NumberSeqDatatype::construct();

           datatype.parmDatatypeId(extendedTypeNum(CMSStudentId));

           datatype.parmReferenceHelp(literalStr('Student ID'));

           datatype.parmWizardIsContinuous(false);

           datatype.parmWizardIsManual(NoYes::No);

           datatype.parmWizardIsChangeDownAllowed(NoYes::No);

           datatype.parmWizardIsChangeUpAllowed(NoYes::No);

           datatype.parmSortField(1);

           datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);

           this.create(datatype);

          // NumberSeqDatatype datatype = NumberSeqDatatype::construct();

           datatype.parmDatatypeId(extendedTypeNum(CMSCourseId));

           datatype.parmReferenceHelp(literalStr('Course ID'));

           datatype.parmWizardIsContinuous(false);

           datatype.parmWizardIsManual(NoYes::No);

           datatype.parmWizardIsChangeDownAllowed(NoYes::No);

           datatype.parmWizardIsChangeUpAllowed(NoYes::No);

           datatype.parmSortField(2);

           datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);

           this.create(datatype);

       }

       public NumberSeqModule numberSeqModule()

       {

           return NumberSeqModule::CMS;

       }

       [SubscribesTo(classStr(NumberSeqGlobal), delegateStr(NumberSeqGlobal, buildModulesMapDelegate))]

       public static void NumberSeqGlobal_buildModulesMapDelegate(Map numberSeqModuleNamesMap)

       {

           NumberSeqGlobal::addModuleToMap(classNum(NumberSeqModuleCMS),numberSeqModuleNamesMap);

       }

    }

    Also I've referenced this class in the form init() calling the via numberSeqPreInit() which contains the following code

    void numberSeqPreInit()

       {

           runExecuteDirect   = false;

           numberSequenceModules = [NumberSeqModule::CMS];

           numberSeqApplicationModule = new NumberSeqModuleCMS();

           scope = NumberSeqScopeFactory::createDataAreaScope();

           NumberSeqApplicationModule::createReferencesMulti(numberSequenceModules, scope);

       }

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    RE: Creating a Number Sequence for Newly Created Module

    You must implement a class extending NumberSeqApplicationModule for your module. Look at existing NumberSeqModule* classes for examples.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans