Monday, June 8, 2020

Enum and how to use and extend them in Microsoft Dynamics 365 Business Central

Hi Readers, 
As you might be aware that Business Central 16 has come with a lot of features from which one of them is advancements in enums. They have been existing from quite some time, but now they are used extensively and most of the fields are extensible. You can also use them for local and global variables as well as parameters. 

But what are exactly enums? They are quite popular in other programming language and doesn't mean anything different. Enums are set of constants which with an assigned ID. It is like a menu through which you can make a choice and this is called enumeration. One example can be an optionstring to which you can add another option value. 

Declare an enum:

Note: Your enum should have Extensible = true, for you to be able to extend it. 

Extend enum:

Usage:
You can use this enum (set/menu) in your table, codeunits and page objects. Here I have already created a field Color in Item table and I am using this enum as optionstring. 



Note: This example is for learning purpose, you can, of course, use your standard fields and add enums and extend them in a real-time scenario. 


I hope this blog was helpful and provided an easy explanation for enum. To know more about enums, visit: Enum in D365BC

Write your suggestions in the comment section. Follow for more interesting blogs like these!

Check Business Central latest blogs: https://jyotsnanav.blogspot.com

You can also email me at jyotsnaoberainav@gmail.com

Also, visit my website JONAV if you need help with any NAV/BC Services!

Thank you!




2 comments:

  1. Your blogs are very useful. Keep up the good work

    ReplyDelete
    Replies
    1. I am glad. Thank you for your feedback. Keep following :)

      Delete