Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Generate a list of mandatory fields

Posted on by 50

Hi,

I wonder if it's possible to generate a list of mandatory fields in AX 2009? For example the mandatory fields when creating a customer.

Can you export this type of data from AX to Excel? It would help me a lot when doing migration since then I know what fields I must have.

*This post is locked for comments

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Generate a list of mandatory fields AX 2009

    Yes, inside AOT inside AX. But this is part of code what you're should write.

    You're should complete the code with export to Excel function with all tables list from AOT.

  • Rikard Ekengren Profile Picture
    Rikard Ekengren 50 on at
    RE: Generate a list of mandatory fields AX 2009

    Hi Rustem,

    Thank you for quick response. Your suggestion sounds great but I'm not sure how to generate the list with this code.

    Do I do it while I'm inside the AOT inside AX?

    Regards

    Rikard

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Generate a list of mandatory fields AX 2009

    Hi Rikard Ekengren!

    To get the all mandatory fields from particular table you should use DictTable and DictField classes. For example:

    static void CheckMandatoryFieldsOnTable(Args _args)
    {
        DictTable dictTable;
        DictField dictField;
        int       i;
        TableId   tableId = tableNum(CustTable);
        ;
        
        dictTable = new DictTable(tableId);
        
        for (i=1 ; i <= dictTable.fieldCnt(); i++)
        {
            dictField = new DictField(tableId, dictTable.fieldCnt2Id(i));
            
            if (dictField.mandatory())
            {
                info(dictField.name());
            }
        }
    }


    But the tables not only the place where mandatory fields can be determine. You can set mandatory property to controls on a form.

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans