{"id":258,"date":"2019-11-14T08:53:16","date_gmt":"2019-11-14T08:53:16","guid":{"rendered":"http:\/\/fredborg.org\/?p=258"},"modified":"2020-12-23T20:45:48","modified_gmt":"2020-12-23T20:45:48","slug":"enums-in-business-central","status":"publish","type":"post","link":"https:\/\/fredborg.org\/?p=258","title":{"rendered":"Enums in Business Central"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this post, I thought that I would try something new, instead of always writing &#8220;long&#8221; blog posts &#x1f634; about somewhat broad topics. I thought that I would write a small nugget, on a specific topic which in this case are Enums. &#x1f60a;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let us start off by looking at what Enums are and why \/ how we use them. You can view Enums as a replacement for the old option type, and the reason why you should use Enums is quite simple. The reason being that unlike options, then Enums can be extended and they are reusable across objects. The way that Enums work is that you declare a new object of type Enum, in which you create the options that you which to use. The code could look something like the code below.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nenum 80200 &quot;Print Actions&quot;\n{\n    Extensible = true;\n\n\n    value(0; None)\n    {\n        Caption = &#039;&#039;;\n    }\n    value(1; &quot;Always Print&quot;)\n    {\n        Caption = &#039;Always Print&#039;;\n    }\n    value(2; &quot;Confirm&quot;)\n    {\n        Caption = &#039;Confirm&#039;;\n  }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Now being the good developers that we are &#x1f913; we should always remember to make our enum object Extensible = true; so that other people can add their own options.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now using the Enum in our objects is very simple, all you have to do is declare it as a type:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nfield(5; &quot;Action&quot;; Enum &quot;Print Actions&quot;)\n        {\n            Caption = &#039;Action&#039;;\n\n        }\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\n\nAnd that is all there is to it, so now all that is left is to start using it in your Extensions. &#x1f609;\n\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, I thought that I would try something new, instead of always writing &#8220;long&#8221; blog posts &#x1f634; about&#8230; <a class=\"read-more\" href=\"https:\/\/fredborg.org\/?p=258\" rel=\"nofollow\"> Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":261,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,1],"tags":[],"class_list":["post-258","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-business-central","category-uncategorized","shapla-grid-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Enums in Business Central - Fredborg<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fredborg.org\/?p=258\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Enums in Business Central - Fredborg\" \/>\n<meta property=\"og:description\" content=\"In this post, I thought that I would try something new, instead of always writing &#8220;long&#8221; blog posts &#x1f634; about... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fredborg.org\/?p=258\" \/>\n<meta property=\"og:site_name\" content=\"Fredborg\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-14T08:53:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-23T20:45:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"322\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"dfredborg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dfredborg\" \/>\n<meta name=\"twitter:site\" content=\"@dfredborg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"dfredborg\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fredborg.org\/?p=258#article\",\"isPartOf\":{\"@id\":\"https:\/\/fredborg.org\/?p=258\"},\"author\":{\"name\":\"dfredborg\",\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d\"},\"headline\":\"Enums in Business Central\",\"datePublished\":\"2019-11-14T08:53:16+00:00\",\"dateModified\":\"2020-12-23T20:45:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fredborg.org\/?p=258\"},\"wordCount\":216,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d\"},\"image\":{\"@id\":\"https:\/\/fredborg.org\/?p=258#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png\",\"articleSection\":[\"Business Central\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fredborg.org\/?p=258#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fredborg.org\/?p=258\",\"url\":\"https:\/\/fredborg.org\/?p=258\",\"name\":\"Enums in Business Central - Fredborg\",\"isPartOf\":{\"@id\":\"https:\/\/fredborg.org\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fredborg.org\/?p=258#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fredborg.org\/?p=258#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png\",\"datePublished\":\"2019-11-14T08:53:16+00:00\",\"dateModified\":\"2020-12-23T20:45:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fredborg.org\/?p=258#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fredborg.org\/?p=258\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fredborg.org\/?p=258#primaryimage\",\"url\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png\",\"contentUrl\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png\",\"width\":600,\"height\":322},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fredborg.org\/?p=258#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fredborg.org\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Enums in Business Central\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fredborg.org\/#website\",\"url\":\"https:\/\/fredborg.org\/\",\"name\":\"Fredborg\",\"description\":\"Business Central and Azure\",\"publisher\":{\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fredborg.org\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d\",\"name\":\"dfredborg\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2023\/06\/download.png\",\"contentUrl\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2023\/06\/download.png\",\"width\":256,\"height\":256,\"caption\":\"dfredborg\"},\"logo\":{\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:fredborg.org\",\"https:\/\/www.linkedin.com\/in\/dfredborg\/\",\"https:\/\/x.com\/dfredborg\",\"https:\/\/www.youtube.com\/channel\/UCUNZglLDMjBlOK_T9JtI8UA\"],\"url\":\"https:\/\/fredborg.org\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Enums in Business Central - Fredborg","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fredborg.org\/?p=258","og_locale":"en_US","og_type":"article","og_title":"Enums in Business Central - Fredborg","og_description":"In this post, I thought that I would try something new, instead of always writing &#8220;long&#8221; blog posts &#x1f634; about... Read more","og_url":"https:\/\/fredborg.org\/?p=258","og_site_name":"Fredborg","article_published_time":"2019-11-14T08:53:16+00:00","article_modified_time":"2020-12-23T20:45:48+00:00","og_image":[{"width":600,"height":322,"url":"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png","type":"image\/png"}],"author":"dfredborg","twitter_card":"summary_large_image","twitter_creator":"@dfredborg","twitter_site":"@dfredborg","twitter_misc":{"Written by":"dfredborg","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fredborg.org\/?p=258#article","isPartOf":{"@id":"https:\/\/fredborg.org\/?p=258"},"author":{"name":"dfredborg","@id":"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d"},"headline":"Enums in Business Central","datePublished":"2019-11-14T08:53:16+00:00","dateModified":"2020-12-23T20:45:48+00:00","mainEntityOfPage":{"@id":"https:\/\/fredborg.org\/?p=258"},"wordCount":216,"commentCount":0,"publisher":{"@id":"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d"},"image":{"@id":"https:\/\/fredborg.org\/?p=258#primaryimage"},"thumbnailUrl":"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png","articleSection":["Business Central"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fredborg.org\/?p=258#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fredborg.org\/?p=258","url":"https:\/\/fredborg.org\/?p=258","name":"Enums in Business Central - Fredborg","isPartOf":{"@id":"https:\/\/fredborg.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fredborg.org\/?p=258#primaryimage"},"image":{"@id":"https:\/\/fredborg.org\/?p=258#primaryimage"},"thumbnailUrl":"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png","datePublished":"2019-11-14T08:53:16+00:00","dateModified":"2020-12-23T20:45:48+00:00","breadcrumb":{"@id":"https:\/\/fredborg.org\/?p=258#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fredborg.org\/?p=258"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fredborg.org\/?p=258#primaryimage","url":"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png","contentUrl":"https:\/\/fredborg.org\/wp-content\/uploads\/2019\/11\/Enums.png","width":600,"height":322},{"@type":"BreadcrumbList","@id":"https:\/\/fredborg.org\/?p=258#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fredborg.org\/"},{"@type":"ListItem","position":2,"name":"Enums in Business Central"}]},{"@type":"WebSite","@id":"https:\/\/fredborg.org\/#website","url":"https:\/\/fredborg.org\/","name":"Fredborg","description":"Business Central and Azure","publisher":{"@id":"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fredborg.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d","name":"dfredborg","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fredborg.org\/#\/schema\/person\/image\/","url":"https:\/\/fredborg.org\/wp-content\/uploads\/2023\/06\/download.png","contentUrl":"https:\/\/fredborg.org\/wp-content\/uploads\/2023\/06\/download.png","width":256,"height":256,"caption":"dfredborg"},"logo":{"@id":"https:\/\/fredborg.org\/#\/schema\/person\/image\/"},"sameAs":["https:fredborg.org","https:\/\/www.linkedin.com\/in\/dfredborg\/","https:\/\/x.com\/dfredborg","https:\/\/www.youtube.com\/channel\/UCUNZglLDMjBlOK_T9JtI8UA"],"url":"https:\/\/fredborg.org\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/posts\/258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=258"}],"version-history":[{"count":3,"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions"}],"predecessor-version":[{"id":262,"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions\/262"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/media\/261"}],"wp:attachment":[{"href":"https:\/\/fredborg.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}