{"id":55531,"date":"2023-04-27T14:30:26","date_gmt":"2023-04-27T13:30:26","guid":{"rendered":"https:\/\/arquiconsult.com\/?p=55531"},"modified":"2024-10-23T10:39:14","modified_gmt":"2024-10-23T09:39:14","slug":"bc-title-and-custom-actions-on-error-dialogs","status":"publish","type":"post","link":"https:\/\/arquiconsult.com\/en\/bc-title-and-custom-actions-on-error-dialogs\/","title":{"rendered":"#039 BC TITLE AND CUSTOM ACTIONS ON ERROR DIALOGS"},"content":{"rendered":"<div class=\"services_vertical horizontal_services row\" style=\"background-color: #f7f7f7; padding: 25px; border-radius: 5px; text-align: justify;\">\n<p>With the release of Business Central 2023 Wave 1 some features have been enhanced. In this ArquiTips we will explore the possibility of adding Title and Custom Actions to Error Dialogs making messages more user-friendly.<\/p>\n<p>It\u2019s possible to add up to two custom actions, that will be displayed on the Error dialog, to provide users with corrective actions, by using the <strong>ErrorInfo <\/strong>Object.<br \/>\nThis can be achieved by calling the <strong>AddAction<\/strong> method on the ErrorInfo Object, which can be passed to AL methods that support ErrorInfo, such as Error, Testfield, FieldError, etc.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p>As an example, we can have the following type of errors:<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" class=\"alignnone wp-image-55536\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/As-an-example-we-can-have-the-following-type-of-errors.jpg\" alt=\"As an example, we can have the following type of errors\" width=\"507\" height=\"225\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/As-an-example-we-can-have-the-following-type-of-errors.jpg 590w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/As-an-example-we-can-have-the-following-type-of-errors-320x142.jpg 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/As-an-example-we-can-have-the-following-type-of-errors-480x213.jpg 480w\" sizes=\"(max-width: 507px) 100vw, 507px\" title=\"-\"><\/p>\n<p>As we can see above, we have two different actions on our error, that will show us different messages if we click on them.<\/p>\n<p><strong>Error Action 1:<\/strong><\/p>\n<p><img loading=\"lazy\" class=\" wp-image-55539 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Error-Action-1.jpg\" alt=\"Error Action 1\" width=\"513\" height=\"203\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Error-Action-1.jpg 586w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Error-Action-1-320x127.jpg 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Error-Action-1-480x190.jpg 480w\" sizes=\"(max-width: 513px) 100vw, 513px\" title=\"-\"><\/p>\n<p><strong>Error Action 2:<\/strong><\/p>\n<p><img loading=\"lazy\" class=\" wp-image-55542 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Error-Action-2.jpg\" alt=\"Error Action 2\" width=\"532\" height=\"221\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Error-Action-2.jpg 590w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Error-Action-2-320x133.jpg 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Error-Action-2-480x199.jpg 480w\" sizes=\"(max-width: 532px) 100vw, 532px\" title=\"-\"><\/p>\n<p>To achieve this outcome, we need to create the following code:<\/p>\n<p><img loading=\"lazy\" class=\" wp-image-55545 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/To-achieve-this-outcome-we-need-to-create-the-following-code.jpg\" alt=\"To achieve this outcome, we need to create the following code\" width=\"527\" height=\"328\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/To-achieve-this-outcome-we-need-to-create-the-following-code.jpg 604w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/To-achieve-this-outcome-we-need-to-create-the-following-code-320x199.jpg 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/To-achieve-this-outcome-we-need-to-create-the-following-code-480x299.jpg 480w\" sizes=\"(max-width: 527px) 100vw, 527px\" title=\"-\"><\/p>\n<p><img loading=\"lazy\" class=\" wp-image-55547 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/ETR-640x373.jpg\" alt=\"ETR\" width=\"529\" height=\"308\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/ETR-640x373.jpg 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/ETR-768x448.jpg 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/ETR-320x186.jpg 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/ETR-480x280.jpg 480w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/ETR-800x466.jpg 800w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/ETR.jpg 834w\" sizes=\"(max-width: 529px) 100vw, 529px\" title=\"-\"><\/p>\n<p>The <strong>AddAction<\/strong> method receives three parameters:<\/p>\n<ol>\n<li><strong>Caption<\/strong>: The text string that appears as the caption of the action in the error UI.<\/li>\n<li><strong>CodeunitID<\/strong>: The ID of the Codeunit to run. This Codeunit should contain at least one global method to be called by the error action. The global method must have an <strong>ErrorInfo <\/strong>data type parameter for accepting the <strong>ErrorInfo<\/strong> Object.<\/li>\n<li><strong>Method Name<\/strong>: The name of the method in the Codeunit specified before.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>With Business Central 2023 Wave 1 (BC22), a new navigation action for the errors has been added.<\/p>\n<p>That being sad, if we for instance, want the user to navigate to the item list when the error occurs, we can add an action to the error for this purpose and the user will go directly from the error message to the item list, in one click.<\/p>\n<p><img loading=\"lazy\" class=\" wp-image-55550 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/The-AddAction-method-receives-three-parameters-640x319.jpg\" alt=\"The AddAction method receives three parameters\" width=\"558\" height=\"278\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/The-AddAction-method-receives-three-parameters-640x319.jpg 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/The-AddAction-method-receives-three-parameters-320x159.jpg 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/The-AddAction-method-receives-three-parameters-480x239.jpg 480w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/The-AddAction-method-receives-three-parameters.jpg 675w\" sizes=\"(max-width: 558px) 100vw, 558px\" title=\"-\"><\/p>\n<p>And the sample code to do it:<\/p>\n<p><img loading=\"lazy\" class=\" wp-image-55553 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/And-the-sample-code-to-do-it-640x390.jpg\" alt=\"And the sample code to do it\" width=\"574\" height=\"350\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/And-the-sample-code-to-do-it-640x390.jpg 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/And-the-sample-code-to-do-it-768x468.jpg 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/And-the-sample-code-to-do-it-320x195.jpg 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/And-the-sample-code-to-do-it-480x292.jpg 480w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/And-the-sample-code-to-do-it.jpg 783w\" sizes=\"(max-width: 574px) 100vw, 574px\" title=\"-\"><\/p>\n<p>There is also a new behavior about Error Messages that is important to mention.<\/p>\n<p>In the previous version of Business Central, the action error message had a dropdown How to Report this issue button.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-55557 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/There-is-also-a-new-behavior-about-Error-Messages-that-is-important-to-mention..jpg\" alt=\"There is also a new behavior about Error Messages that is important to mention.\" width=\"467\" height=\"202\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/There-is-also-a-new-behavior-about-Error-Messages-that-is-important-to-mention..jpg 467w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/There-is-also-a-new-behavior-about-Error-Messages-that-is-important-to-mention.-320x138.jpg 320w\" sizes=\"(max-width: 467px) 100vw, 467px\" title=\"-\"><\/p>\n<p>When we clicked on this button, we could see some information, and we had another button &#8211; Copy information to clipboard \u2013 and if we copied it, we could paste it elsewhere, for instance on a notepad, and see exactly where our program stopped.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-55560 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/When-we-clicked-on-this-button.jpg\" alt=\"When we clicked on this button,\" width=\"440\" height=\"382\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/When-we-clicked-on-this-button.jpg 440w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/When-we-clicked-on-this-button-320x278.jpg 320w\" sizes=\"(max-width: 440px) 100vw, 440px\" title=\"-\"><\/p>\n<p>Now, with the release of the new BC22, this has changed a little, and we have right on the error message a button Copy Details that does the same thing as the Copy information to clipboard.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-55563 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Now-with-the-release-of-the-new-BC22-this-has-changed-a-little.jpg\" alt=\"Now, with the release of the new BC22, this has changed a little,\" width=\"448\" height=\"228\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Now-with-the-release-of-the-new-BC22-this-has-changed-a-little.jpg 448w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/Now-with-the-release-of-the-new-BC22-this-has-changed-a-little-320x163.jpg 320w\" sizes=\"(max-width: 448px) 100vw, 448px\" title=\"-\"><\/p>\n<p>When we copy the information, we get this message confirming it, and we just need to paste it where is convenient for us, for example notepad.<\/p>\n<p><img loading=\"lazy\" class=\" wp-image-55566 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/When-we-copy-the-information-we-get-this-message-confirming-it-and-we-just-need-to-paste-it-where-is-convenient-for-us-for-example-notepad..jpg\" alt=\"When we copy the information, we get this message confirming it, and we just need to paste it where is convenient for us, for example notepad.\" width=\"529\" height=\"304\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/When-we-copy-the-information-we-get-this-message-confirming-it-and-we-just-need-to-paste-it-where-is-convenient-for-us-for-example-notepad..jpg 604w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/When-we-copy-the-information-we-get-this-message-confirming-it-and-we-just-need-to-paste-it-where-is-convenient-for-us-for-example-notepad.-320x184.jpg 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2023\/07\/When-we-copy-the-information-we-get-this-message-confirming-it-and-we-just-need-to-paste-it-where-is-convenient-for-us-for-example-notepad.-480x276.jpg 480w\" sizes=\"(max-width: 529px) 100vw, 529px\" title=\"-\"><\/p>\n<p>&nbsp;<\/p>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-55531\" data-postid=\"55531\" class=\"themify_builder_content themify_builder_content-55531 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_gbri892 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_bl4o893 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_bxd2893 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>With the release of Business Central 2023 Wave 1 some features have been enhanced. In this ArquiTips we will explore the possibility of adding Title and Custom Actions to Error Dialogs making messages more user-friendly. It\u2019s possible to add up to two custom actions, that will be displayed on the Error dialog, to provide users [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":55609,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2099,2124],"tags":[2379,2076,2378],"acf":[],"_links":{"self":[{"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/posts\/55531"}],"collection":[{"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/comments?post=55531"}],"version-history":[{"count":0,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/posts\/55531\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/media\/55609"}],"wp:attachment":[{"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/media?parent=55531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/categories?post=55531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/tags?post=55531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}