Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Answered

Load new NumberSequence error : the datatypeid field is mandatory

Posted on by

Hi,

I'm creating new number sequence, it was succeeded but then import the EDT and the classes made it into a new environment. After successfully Build with no error, when trying to run the LoadModule class, it always give me an error :

pastedimage1666319519961v1.png

Spend sometime to check what I probably missed when import but seems (in my knowledge so far) all is imported. May I get advice what's wrong ?

Here are the objects which I believe all there is to create new Number Sequence : 

1. Create EDT : My_StatetNum

2. Create CoC, and since I want to put it into AR Parameters, extend NumberSeqModuleCustomer

[ExtensionOf(classStr(NumberSeqModuleCustomer))]
final class My_NumberSeqModuleCust_Extension
{

    protected void loadModule()
    {
        next loadModule();
        NumberSeqDatatype datatypeExtend = NumberSeqDatatype::construct();

        /* Setup state numbers */
        datatypeExtend.parmDatatypeId(extendedtypenum(My_StateNumber));
        datatypeExtend.parmReferenceHelp(literalstr("Unique key for state."));
        datatypeExtend.parmWizardIsContinuous(false);
        datatypeExtend.parmWizardfetchAheadQty(5);
        datatypeExtend.parmWizardIsManual(NoYes::No);
        datatypeExtend.parmWizardIsChangeDownAllowed(NoYes::No);
        datatypeExtend.parmWizardIsChangeUpAllowed(NoYes::No);
        datatypeExtend.parmWizardHighest(999999);
        datatypeExtend.parmSortField(10000);
        datatypeExtend.addParameterType(NumberSeqParameterType::DataArea, true, false);
        this.create(datatypeExtend);
    }

}

3. Create CoC on CustParameters table

[ExtensionOf(tableStr(CustParameters))]
final class My_CustParameters_Extension
{
     
    client server static NumberSequenceReference numRef_My_StateNumber()
    {
        return NumberSeqReference::findReference(extendedTypeNum(My_StateNumber));
    }

}

4. Create runable class for LoadModule

internal final class My_LoadNumberSeq
{
    /// 
    /// Class entry point. The system will call this method when a designated menu 
    /// is selected or when execution starts and this class is set as the startup class.
    /// 
    /// The specified arguments.
    public static void main(Args _args)
    {
        
        NumberSeqModuleCustomer numberSeqModCust = new NumberSeqModuleCustomer();
        
        numberSeqModCust.load();
    }

}

4. run this in browser

I tried to debug this runable class, and it seems the code not calling numberSeqModCust.load(); When I pressed Step into, it doesn't step in and the error raise.

Please help.

  • VoltesDev Profile Picture
    VoltesDev on at
    RE: Load new NumberSequence error : the datatypeid field is mandatory

    Hi Girish,

    Much thanks. I have to remove the "protected" in the loadmodule_extension() since it is makes error. It's finally works!

    I'm not sure why had to be this way, though. Since the CoC is works in my 1st environment.

    Anyway thank you very much for your help.

  • Verified answer
    GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Load new NumberSequence error : the datatypeid field is mandatory

    Oh sorry its my mistake. You need to create object for your class not standard class. Like below.

    internal final class My_LoadNumberSeq
    {
        /// 
        /// Class entry point. The system will call this method when a designated menu 
        /// is selected or when execution starts and this class is set as the startup class.
        /// 
        /// The specified arguments.
        public static void main(Args _args)
        {
            
            MyNumberSeqCustExtension numberSeqModCust = new MyNumberSeqCustExtension();
            
            numberSeqModCust.loadModule_Extension();
        }
    
    }

    Thanks,

    Girish S.

  • VoltesDev Profile Picture
    VoltesDev on at
    RE: Load new NumberSequence error : the datatypeid field is mandatory

    Hi Girish,

    Here it is. Thanks.

    pastedimage1666338236792v2.png

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Load new NumberSequence error : the datatypeid field is mandatory

    Can you  show me the screenshot of the loadModule_Extension method class.

    Thanks,

    Girish S.

  • VoltesDev Profile Picture
    VoltesDev on at
    RE: Load new NumberSequence error : the datatypeid field is mandatory

    Hi,

    Tried as per your advice, and strangely I'm hit this odd error ->

    Severity Code Description Project File Line Suppression State
    Error ClassDoesNotContainMethod: Class 'NumberSeqModuleCustomer' does not contain a definition for method 'loadModule_Extension' and no extension method 'loadModule_Extension' accepting a first argument of type 'NumberSeqModuleCustomer' is found on any extension class. MyDevelopment (USR) [MYDev] 

    It is highlighting the main() in LoadModule runable class

    pastedimage1666337905476v1.png

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Load new NumberSequence error : the datatypeid field is mandatory

    Hi VoltesDev,

    If the COC doesn't work try extending the class like below.

    class My_NumberSeqModuleCustExtension extends NumberSeqModuleCustomer
    {
    
        protected void loadModule_Extension()
        {
            NumberSeqDatatype datatypeExtend = NumberSeqDatatype::construct();
    
            /* Setup state numbers */
            datatypeExtend.parmDatatypeId(extendedtypenum(My_StateNumber));
            datatypeExtend.parmReferenceHelp(literalstr("Unique key for state."));
            datatypeExtend.parmWizardIsContinuous(false);
            datatypeExtend.parmWizardfetchAheadQty(5);
            datatypeExtend.parmWizardIsManual(NoYes::No);
            datatypeExtend.parmWizardIsChangeDownAllowed(NoYes::No);
            datatypeExtend.parmWizardIsChangeUpAllowed(NoYes::No);
            datatypeExtend.parmWizardHighest(999999);
            datatypeExtend.parmSortField(10000);
            datatypeExtend.addParameterType(NumberSeqParameterType::DataArea, true, false);
            this.create(datatypeExtend);
        }
    
    }

    Now create a runnable class and add below code.

    internal final class My_LoadNumberSeq
    {
        /// 
        /// Class entry point. The system will call this method when a designated menu 
        /// is selected or when execution starts and this class is set as the startup class.
        /// 
        /// The specified arguments.
        public static void main(Args _args)
        {
            
            NumberSeqModuleCustomer numberSeqModCust = new NumberSeqModuleCustomer();
            
            numberSeqModCust.loadModule_Extension();
        }
    
    }

    Thanks,

    Girish S.

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans