web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Specify the default value of field type enum?

(0) ShareShare
ReportReport
Posted on by 47

Hi, I added a field JOBCat to the customer table and give it an Enum as the following:

enum 50102 JobsCat
{
value(0; "Web Developer")
{
}
value(1; "Mobile Developer")
{
}
value(2; "Desktop Developer")
{
}
value(99; "Jobless")
{
}
}

The problem is all customer affected to the first job in enum, question is how can I specify the job of enum by default?

for example, all customers must have Jobless which has 99 id of enum.

I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    92,367 Super User 2025 Season 2 on at
    RE: Specify the default value of field type enum?

    Hi, hope the following can give you some hints.

    How to set default Account type in General Journals (Customization)

    https://yzhums.com/26385/

    Thanks.

    ZHU

  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,191 Super User 2025 Season 2 on at
    RE: Specify the default value of field type enum?

    The default is set on the table fields that are using the enum using InitValue property. You don't set the default value on the enum object itself.

  • Suggested answer
    Nitin Verma Profile Picture
    21,666 Moderator on at
    RE: Specify the default value of field type enum?

    Hi,

    Adding More info. If you use InitValue property it will not update existing records instead it will change the values as you are requesting only on new records, to update the existing report, I would prefer the Config. Package or Batch report to update all the records. anyways find the below code it will work for all new customers.

    tableextension 50105 "Modify CustomerCard" extends Customer
    {
        fields
        {
            field(50000; JobCat; Enum JobsCat)
            {
                Caption = 'JobCat';
                InitValue = Jobless;            
                DataClassification = ToBeClassified;
            }
        }
    }
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,037 Moderator on at
    RE: Specify the default value of field type enum?

    Have you tried the initvalue property?

    learn.microsoft.com/.../devenv-initvalue-property

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 4,304

#2
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,045

#3
Sumit Singh Profile Picture

Sumit Singh 2,970

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans