{"id":38550,"date":"2021-12-09T12:18:11","date_gmt":"2021-12-09T12:18:11","guid":{"rendered":"https:\/\/arquiconsult.com\/?p=38550"},"modified":"2024-10-23T13:52:49","modified_gmt":"2024-10-23T12:52:49","slug":"collectable-errors-in-al","status":"publish","type":"post","link":"https:\/\/arquiconsult.com\/es\/collectable-errors-in-al\/","title":{"rendered":"#014 COLLECTABLE ERRORS IN AL"},"content":{"rendered":"<div class=\"services_vertical horizontal_services row\" style=\"background-color: #f7f7f7; padding: 25px; border-radius: 5px; text-align: justify;\">\n<p style=\"font-weight: 400;\">Since the release of Business Central 2021 wave 2, there is a feature that introduces a new way to raise errors, the Collectable Errors.<\/p>\n<p style=\"font-weight: 400;\">With this new feature, the system does not break the current activity, even if multiple errors are raised, until the code procedure ends. This improves the user experience as it will show the errors in one shot, instead of breaking the system for each error found.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p style=\"font-weight: 400;\"><strong>How it works?<\/strong><\/p>\n<p style=\"font-weight: 400;\">If during the execution of the code there were multiple errors, the first one will appear in the main section of the error window and the others will appear in the Detailed Information.\u00a0To create a collectable error, we need the:<\/p>\n<ul style=\"font-weight: 400;\">\n<li>[ErrorBehavior(ErrorBehavior::Collect)] syntax<\/li>\n<li>ErrorInfo must be set as Collectible(true)<\/li>\n<\/ul>\n<p style=\"font-weight: 400;\"><strong>Example<\/strong><strong>:<\/strong><\/p>\n<p style=\"font-weight: 400;\"><strong>The following function checks if some fields are empty in Customer Card.<\/strong><\/p>\n<p><img loading=\"lazy\" class=\" wp-image-37823 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/The-following-function-checks-if-some-fields-are-empty-in-Customer-Card.-640x327.png\" alt=\"The following function checks if some fields are empty in Customer Card.\" width=\"722\" height=\"369\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/The-following-function-checks-if-some-fields-are-empty-in-Customer-Card.-640x327.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/The-following-function-checks-if-some-fields-are-empty-in-Customer-Card.-768x392.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/The-following-function-checks-if-some-fields-are-empty-in-Customer-Card..png 1363w\" sizes=\"(max-width: 722px) 100vw, 722px\" title=\"-\"><\/p>\n<p><strong>Using the Collectible(true) method, the errors appear in the same window as shown below:<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-37828 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/01\/Using-the-Collectibletrue-method-the-errors-appear-in-the-same-window-as-shown-below.png\" alt=\"Using the Collectible(true) method, the errors appear in the same window as shown below\" width=\"466\" height=\"459\" title=\"-\"><\/p>\n<p style=\"font-weight: 400;\">If we comment out the line where we set Collectible = true, the code will stop at the first error, displaying the message in Detailed Information.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"services_vertical horizontal_services row\" style=\"background-color: #f7f7f7; padding: 25px; border-radius: 5px;\">\n<p style=\"font-weight: 400;\"><strong>Official documentation from Microsoft is available here:<br \/>\n<\/strong><strong><a href=\"https:\/\/docs.microsoft.com\/en-us\/dynamics365\/business-central\/dev-itpro\/developer\/methods-auto\/errorinfo\/errorinfo-data-type\" target=\"_blank\" rel=\"noopener\">https:\/\/docs.microsoft.com\/en-us\/dynamics365\/business-central\/dev-itpro\/developer\/methods-auto\/errorinfo\/errorinfo-data-type<\/a>.<\/strong><\/p>\n<\/div>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-38550\" data-postid=\"38550\" class=\"themify_builder_content themify_builder_content-38550 themify_builder tf_clear\">\n    \t<!-- module_row -->\n\t<div  data-lazy=\"1\" class=\"module_row themify_builder_row tb_nus1581 tb_first tf_clearfix\">\n\t    \t\t<div class=\"row_inner col_align_top col-count-1 tf_box tf_w tf_rel\">\n\t\t\t<div  data-lazy=\"1\" class=\"module_column tb-column col-full first tb_cai8581 tf_box\">\n\t\t\t    \t        <div class=\"tb-column-inner tf_box tf_w\">\n\t\t    <!-- module text -->\n<div  class=\"module module-text tb_9tkr581 arquitps-data  \" data-lazy=\"1\">\n        <div  class=\"tb_text_wrap\">\n    <p><script>\njQuery(\".tbp_post_month:contains(Janeiro)\").html(\"January\");\n\njQuery(\".tbp_post_month:contains(Fevereiro)\").html(\"February\");\n\n\njQuery(\".tbp_post_month:contains(Mar\u00e7o)\").html(\"March\");\n\n\njQuery(\".tbp_post_month:contains(Abril)\").html(\"April\");\n\n\njQuery(\".tbp_post_month:contains(Maio)\").html(\"May\");\n\n\njQuery(\".tbp_post_month:contains(Junho)\").html(\"June\");\n\n\njQuery(\".tbp_post_month:contains(Julho)\").html(\"July\");\n\njQuery(\".tbp_post_month:contains(Agosto)\").html(\"August\");\n\njQuery(\".tbp_post_month:contains(Setembro)\").html(\"September\");\n\njQuery(\".tbp_post_month:contains(Outubro)\").html(\"October\");\n\njQuery(\".tbp_post_month:contains(Novembro)\").html(\"November\");\n\njQuery(\".tbp_post_month:contains(Dezembro)\").html(\"December\");\t\n\n\n\n<\/script><\/p>    <\/div>\n<\/div>\n<!-- \/module text -->\t        <\/div>\n\t    \t<\/div>\n\t\t    <\/div>\n\t    <!-- \/row_inner -->\n\t<\/div>\n\t<!-- \/module_row -->\n\t\t<!-- module_row -->\n\t<div  data-anchor=\"sucesso\" data-hide-anchor=\"1\" data-lazy=\"1\" class=\"module_row themify_builder_row sucesso repeat tb_has_section tb_section-sucesso tb_li5j642 tf_clearfix\" >\n\t    \t\t<div class=\"row_inner col_align_top col-count-1 tf_box tf_w tf_rel\">\n\t\t\t<div  data-lazy=\"1\" class=\"module_column tb-column col-full first tb_27ht642 tf_box\">\n\t\t\t    \t        <div class=\"tb-column-inner tf_box tf_w\">\n\t\t    <!-- module buttons -->\n<div  class=\"module module-buttons tb_nj71642 buttons-horizontal transparent popmake-24705 large circle tf_textc\" data-lazy=\"1\">\n    \t<div class=\"module-buttons-item tf_inline_b\">\n\t\t\t\t\t\t\t<a href=\"#\" class=\"ui builder_button tb_default_color\" >\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"tf_inline_b tf_vmiddle\">Give as a Feedback and Suggest Questions<\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t    \t<\/div>\n\t<\/div>\n<!-- \/module buttons -->\n\t        <\/div>\n\t    \t<\/div>\n\t\t    <\/div>\n\t    <!-- \/row_inner -->\n\t<\/div>\n\t<!-- \/module_row -->\n\t<\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>Since the release of Business Central 2021 wave 2, there is a feature that introduces a new way to raise errors, the Collectable Errors. With this new feature, the system does not break the current activity, even if multiple errors are raised, until the code procedure ends. This improves the user experience as it will [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":37991,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2065],"tags":[2087,2088],"acf":[],"_links":{"self":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/posts\/38550"}],"collection":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/comments?post=38550"}],"version-history":[{"count":0,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/posts\/38550\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/media\/37991"}],"wp:attachment":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/media?parent=38550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/categories?post=38550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/tags?post=38550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}