{"id":9784,"date":"2025-11-30T14:33:33","date_gmt":"2025-11-30T14:33:33","guid":{"rendered":"https:\/\/powergi.net\/?p=9784"},"modified":"2026-06-16T16:54:46","modified_gmt":"2026-06-16T16:54:46","slug":"confirmation-dialog-before-finishing-bpf","status":"publish","type":"post","link":"https:\/\/powergi.net\/es\/blog\/confirmation-dialog-before-finishing-bpf\/","title":{"rendered":"A\u00f1adir un di\u00e1logo de confirmaci\u00f3n antes de finalizar el Flujo de procesos de negocio | Flujo de procesos de negocio | Aplicaci\u00f3n basada en modelo"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"9784\" class=\"elementor elementor-9784\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-50ffdef e-flex e-con-boxed e-con e-parent\" data-id=\"50ffdef\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"jet_parallax_layout_list\":[]}'>\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-c4af9cb elementor-toc--minimized-on-tablet elementor-widget elementor-widget-table-of-contents\" data-id=\"c4af9cb\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings='{\"exclude_headings_by_selector\":[],\"no_headings_message\":\"No headings were found on this page.\",\"headings_by_tags\":[\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],\"marker_view\":\"numbers\",\"minimize_box\":\"yes\",\"minimized_on\":\"tablet\",\"hierarchical_view\":\"yes\",\"min_height\":{\"unit\":\"px\",\"size\":\"\",\"sizes\":[]},\"min_height_tablet\":{\"unit\":\"px\",\"size\":\"\",\"sizes\":[]},\"min_height_mobile\":{\"unit\":\"px\",\"size\":\"\",\"sizes\":[]}}' data-widget_type=\"table-of-contents.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-toc__header\">\n\t\t\t\t\t\t<h4 class=\"elementor-toc__header-title\">\n\t\t\t\tTable of Contents\t\t\t<\/h4>\n\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-toc__toggle-button elementor-toc__toggle-button--expand\" role=\"button\" tabindex=\"0\" aria-controls=\"elementor-toc__c4af9cb\" aria-expanded=\"true\" aria-label=\"Abrir la tabla de contenidos\"><i aria-hidden=\"true\" class=\"fas fa-chevron-down\"><\/i><\/div>\n\t\t\t\t<div class=\"elementor-toc__toggle-button elementor-toc__toggle-button--collapse\" role=\"button\" tabindex=\"0\" aria-controls=\"elementor-toc__c4af9cb\" aria-expanded=\"true\" aria-label=\"Cerrar la tabla de contenidos\"><i aria-hidden=\"true\" class=\"fas fa-chevron-up\"><\/i><\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<div id=\"elementor-toc__c4af9cb\" class=\"elementor-toc__body\">\n\t\t\t<div class=\"elementor-toc__spinner-container\">\n\t\t\t\t<i class=\"elementor-toc__spinner eicon-animation-spin eicon-loading\" aria-hidden=\"true\"><\/i>\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1f97f7f elementor-widget elementor-widget-text-editor\" data-id=\"1f97f7f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\">In some scenarios, we may need\u00a0to ask users for double confirmation when they click on the \u201cfinish\u201d button of a business process flow (BPF)\u00a0and\u00a0only allow the process to finish after explicit confirmation.<\/span><\/p><p><img fetchpriority=\"high\" decoding=\"async\" style=\"-webkit-user-drag: none; -webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; user-select: text; vertical-align: baseline; font-family: 'Segoe UI', 'Segoe UI Web', Arial, Verdana, sans-serif; font-size: 12px; white-space: pre !important;\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2026\/06\/migrated-img-9784-6a4450a4d501f.png\" alt=\"Automatically change the Business Process Flow (PBF)\" width=\"550\" height=\"246\"><\/p><p>This blog will show how to use JavaScript code to customize Model-Driven Apps\u00a0and show users a confirmation dialog before finishing BPFs (business process flow).\u00a0It\u2019s\u00a0important to note that restrictions on forms built with JavaScript code are\u00a0client-side validation, so it will only happen in the actual form that the code is added to.<\/p><p><img decoding=\"async\" style=\"-webkit-user-drag: none; -webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; user-select: text; vertical-align: baseline; font-family: 'Segoe UI', 'Segoe UI Web', Arial, Verdana, sans-serif; font-size: 12px; white-space: pre !important;\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2026\/06\/migrated-img-9784-6a4450a510376.png\" alt=\"How to Implement JavaScript Confirmation Dialogs in Power Apps and Dynamics 365 - Carl de Souza\" width=\"440\" height=\"292\"><\/p><div id=\"seology-cta-1\">\t\t<div data-elementor-type=\"section\" data-elementor-id=\"7280\" class=\"elementor elementor-7280\" data-elementor-post-type=\"elementor_library\">\n\t\t\t<div class=\"elementor-element elementor-element-7e3f164 e-con-full e-flex e-con e-parent\" data-id=\"7e3f164\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"background_background\":\"classic\",\"jet_parallax_layout_list\":[]}'>\n\t\t<div class=\"elementor-element elementor-element-9078c9f e-con-full e-flex e-con e-child\" data-id=\"9078c9f\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"jet_parallax_layout_list\":[]}'>\n\t\t\t\t<div class=\"elementor-element elementor-element-7b99949 elementor-widget elementor-widget-heading\" data-id=\"7b99949\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Automate tasks that slow you down<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8e61db5 elementor-widget elementor-widget-heading\" data-id=\"8e61db5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Free up your team\u2019s time and focus on strategic work with digital and robotic automation.<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-a578907 e-flex e-con-boxed e-con e-child\" data-id=\"a578907\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"jet_parallax_layout_list\":[]}'>\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e8c827b elementor-view-stacked elementor-shape-circle elementor-widget elementor-widget-icon\" data-id=\"e8c827b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-wrapper\">\n\t\t\t<a class=\"elementor-icon\" href=\"#ctc_chat\">\n\t\t\t<i aria-hidden=\"true\" class=\"fab fa-whatsapp\"><\/i>\t\t\t<\/a>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d834237 elementor-view-stacked elementor-shape-circle elementor-widget elementor-widget-icon\" data-id=\"d834237\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-wrapper\">\n\t\t\t<a class=\"elementor-icon\" href=\"https:\/\/powergi.net\/es\/contact\/\">\n\t\t\t<i aria-hidden=\"true\" class=\"far fa-envelope\"><\/i>\t\t\t<\/a>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c630ae4 elementor-widget elementor-widget-heading\" data-id=\"c630ae4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Use case description<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f632845 elementor-widget elementor-widget-text-editor\" data-id=\"f632845\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span data-contrast=\"auto\">For this use case, we assume that we have a model-driven app for new suppliers that need to be created in the system and require approval from accounting and procurement teams. These two teams will approve or reject all suppliers and finally the master data analyst will come to the app and finish the business process flow to confirm they\u00a0want\u00a0to create the supplier in the system.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p><p><span data-contrast=\"auto\">The confirmation dialog will show up to the master data users so they can confirm or cancel the creation in the system.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p><p><span data-contrast=\"auto\">If they click on the confirm button: the business process flow will indeed finish.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p><p><span data-contrast=\"auto\">If they click on the\u00a0cancel\u00a0button:\u00a0nothing will happen.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f5c0176 elementor-widget elementor-widget-heading\" data-id=\"f5c0176\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Solution description<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4cde5bb elementor-widget elementor-widget-text-editor\" data-id=\"4cde5bb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span data-contrast=\"auto\">To\u00a0have the user explicitly confirm that they want to really finish the business process flow, we implement a client-side validation approach using\u00a0JavaScrupt\u00a0and\u00a0the\u00a0addOnPreProcessStatusChange\u00a0event handler, which\u00a0stops the BPF from moving forward\u00a0to finishing the process.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p><p><span data-contrast=\"auto\">To ensure the confirmation happens only once per record, we\u00a0will create\u00a0a dedicated flag field in the Dataverse table that is updated when the user confirms they want to continue.<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4eed8ce elementor-widget elementor-widget-heading\" data-id=\"4eed8ce\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Step 1. Pre-requisites <\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-eb4a3c8 elementor-widget elementor-widget-text-editor\" data-id=\"eb4a3c8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span data-contrast=\"auto\">Before moving forward to writing any code, make sure\u00a0you\u2019ve\u00a0completed the following:<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p><ol><li>Create Dataverse Table\u00a0<\/li><li>Create a field to \u201capprove\u201d or \u201creject\u201d the supplier. The name for our field will be \u201capproval_status\u201d<\/li><li>Create business process flow (BPF), add the appropriate stages\/steps and fields for each stage. In this case, we will add the\u00a0\u00a0<\/li><li>Add a flag field that we will call \u201cconfirm_bpf\u201d. This will be a type text field and we will set it to \u201cYes\u201d when the user confirms. If the user hasn\u2019t confirmed, the value will be null.\u00a0<\/li><li>Set up the Form on the table<\/li><li>Create the Model-Driven App and add the table to it<\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4ae5caf elementor-widget elementor-widget-heading\" data-id=\"4ae5caf\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Step 2. Write JavaScript Code<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-54d25c4 elementor-widget elementor-widget-text-editor\" data-id=\"54d25c4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span data-contrast=\"auto\">To add the confirmation dialog, the following code is needed:<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3d55b2c elementor-widget elementor-widget-code-highlight\" data-id=\"3d55b2c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly class=\"language-javascript\">\n\t\t\t\t\t<xmp>\/\/ Global flag used to avoid reopening the confirmation dialog\u00a0\n\nvar\u00a0saveFromConfirmDialog\u00a0= false;\u00a0\n\n\u00a0\n\n\/\/ Function to register the BPF pre-status-change handler\u00a0\n\nfunction\u00a0hide_AX_AI_Complete_Fields(executionContext) {\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0 \/\/ Get the form context\u00a0\n\n\u00a0\u00a0\u00a0 var\u00a0formContext\u00a0=\u00a0executionContext.getFormContext();\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0 \/\/ Register handler that runs before the BPF status changes\u00a0\n\n\u00a0\u00a0\u00a0\u00a0formContext.data.process.addOnPreProcessStatusChange(confirmOK);\u00a0\n\n}\u00a0\n\n\u00a0\n\n\/\/ Function executed before the Business Process Flow status changes\u00a0\n\nfunction\u00a0confirmOK(executionContext) {\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0 \/\/ Get the form context\u00a0\n\n\u00a0\u00a0\u00a0 var\u00a0formContext\u00a0=\u00a0executionContext.getFormContext();\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0 \/\/ Get current BPF status\u00a0\n\n\u00a0\u00a0\u00a0 var status =\u00a0formContext.data.process.getStatus();\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0 \/\/ Safely retrieve the confirmation field value\u00a0\n\n\u00a0\u00a0\u00a0 var\u00a0campoConfirmAttr\u00a0=\u00a0formContext.getAttribute(\"pgi_confirm_bpf\");\u00a0\n\n\u00a0\u00a0\u00a0 var\u00a0campoConfirmValue\u00a0= null;\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0 if (campoConfirmAttr) {\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0campoConfirmValue\u00a0=\u00a0campoConfirmAttr.getValue();\u00a0\n\n\u00a0\u00a0\u00a0 }\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0 \/\/ If the record has NOT been confirmed yet\u00a0\n\n\u00a0\u00a0\u00a0 if (campoConfirmValue\u00a0!== \"Yes\") {\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Prevent the BPF from completing while confirmation is pending\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (status !== \"finished\" &amp;&amp; !saveFromConfirmDialog) {\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0executionContext.getEventArgs().preventDefault();\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Retrieve the BPF header control\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var control =\u00a0formContext.getControl(\"pgi_approval_status\");\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var\u00a0textControl\u00a0= null;\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (control) {\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var attribute =\u00a0control.getAttribute();\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (attribute) {\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0textControl\u00a0=\u00a0attribute.getText();\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Show confirmation dialog only if status is \"Accept\"\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ and confirmation dialog was not already accepted\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (textControl\u00a0=== \"Accept\" &amp;&amp; !saveFromConfirmDialog) {\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Xrm.Navigation.openConfirmDialog(\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 title: \"Confirm\",\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 text: \"Are you sure you want to\u00a0create\u00a0this supplier?\",\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0confirmButtonLabel: \"OK\",\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0cancelButtonLabel: \"Cancel\"\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 },\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 height: 120,\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 width: 260\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0).then(function (success) {\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ User clicked OK\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (success.confirmed) {\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Set flag to avoid dialog reopening\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0saveFromConfirmDialog\u00a0= true;\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Set confirmation field value\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var\u00a0campoConfirm\u00a0=\u00a0formContext.getAttribute(\"pgi_confirm_bpf\u00a0\");\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if (campoConfirm) {\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0campoConfirm.setValue(\"Yes\");\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Manually finish the BPF\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0formContext.data.process.setStatus(\"finished\");\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\u00a0\n\n\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ If cancelled, the BPF\u00a0remains\u00a0blocked\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 });\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\u00a0\n\n\u00a0\u00a0\u00a0 }\u00a0\n\n}\u00a0<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6a02cd5 elementor-widget elementor-widget-heading\" data-id=\"6a02cd5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Step 3. Uploading JavaScript code and setting up event handler<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a407406 elementor-widget elementor-widget-text-editor\" data-id=\"a407406\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span class=\"TextRun SCXW49468529 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW49468529 BCX0\">The next step is to upload the code to the Dataverse table.\u00a0<\/span><span class=\"NormalTextRun SCXW49468529 BCX0\">We\u2019ve<\/span><span class=\"NormalTextRun SCXW49468529 BCX0\">\u00a0covered these steps in other blogs, you can review the step-by-step in this link:\u00a0<\/span><\/span><a class=\"Hyperlink SCXW49468529 BCX0\" href=\"https:\/\/powergi.net\/blog\/restrict-saving-a-record-in-model-driven-apps\/\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW49468529 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW49468529 BCX0\" data-ccp-charstyle=\"Hyperlink\">https:\/\/powergi.net\/blog\/restrict-saving-a-record-in-model-driven-apps\/<\/span><\/span><\/a><span class=\"TextRun SCXW49468529 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW49468529 BCX0\">, or watch the video in the next section.<\/span><\/span><span class=\"EOP SCXW49468529 BCX0\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a61fe84 elementor-widget elementor-widget-heading\" data-id=\"a61fe84\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Step-by-step video walkthrough<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a15d47c elementor-widget elementor-widget-text-editor\" data-id=\"a15d47c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span data-contrast=\"auto\">Watch the video\u00a0below\u00a0by\u00a0<\/span><a href=\"https:\/\/www.linkedin.com\/in\/maria-graciela-martinez-865a758a\/\" target=\"_blank\" rel=\"noopener\"><span data-contrast=\"none\">Graciela<\/span><\/a><span data-contrast=\"auto\">, where she shows the process of\u00a0uploading JavaScript customizations to\u00a0Dataverse\u00a0forms\u00a0that are used through model-driven apps.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p><div id=\"seology-cta-2\">\t\t<div data-elementor-type=\"section\" data-elementor-id=\"7531\" class=\"elementor elementor-7531\" data-elementor-post-type=\"elementor_library\">\n\t\t\t<div class=\"elementor-element elementor-element-7e3f164 e-con-full e-flex e-con e-parent\" data-id=\"7e3f164\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"background_background\":\"classic\",\"jet_parallax_layout_list\":[]}'>\n\t\t<div class=\"elementor-element elementor-element-9078c9f e-con-full e-flex e-con e-child\" data-id=\"9078c9f\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"jet_parallax_layout_list\":[]}'>\n\t\t\t\t<div class=\"elementor-element elementor-element-7b99949 elementor-widget elementor-widget-heading\" data-id=\"7b99949\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Are you ready to discover the joy of automation?<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8e61db5 elementor-widget elementor-widget-heading\" data-id=\"8e61db5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Whether you have a project in mind or just want to know how we can help, we\u2019re happy to have a conversation<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-a578907 e-flex e-con-boxed e-con e-child\" data-id=\"a578907\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"jet_parallax_layout_list\":[]}'>\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e8c827b elementor-view-stacked elementor-shape-circle elementor-widget elementor-widget-icon\" data-id=\"e8c827b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-wrapper\">\n\t\t\t<a class=\"elementor-icon\" href=\"#ctc_chat\">\n\t\t\t<i aria-hidden=\"true\" class=\"fab fa-whatsapp\"><\/i>\t\t\t<\/a>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d834237 elementor-view-stacked elementor-shape-circle elementor-widget elementor-widget-icon\" data-id=\"d834237\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-wrapper\">\n\t\t\t<a class=\"elementor-icon\" href=\"https:\/\/powergi.net\/es\/contact\/\">\n\t\t\t<i aria-hidden=\"true\" class=\"far fa-envelope\"><\/i>\t\t\t<\/a>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<\/div><p><span data-contrast=\"auto\">This video shows a different\u00a0use case\u00a0that is uploaded to the form, but the same process\u00a0of uploading\u00a0custom code to Dataverse is the same.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0923eb6 elementor-widget elementor-widget-video\" data-id=\"0923eb6\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings='{\"youtube_url\":\"https:\\\/\\\/www.youtube.com\\\/watch?v=kJPt5ZoLqVg\",\"video_type\":\"youtube\",\"controls\":\"yes\"}' data-widget_type=\"video.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-wrapper elementor-open-inline\">\n\t\t\t<div class=\"elementor-video\"><\/div>\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0df9552 elementor-widget elementor-widget-heading\" data-id=\"0df9552\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">How our Power Apps Development services can help<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a3990ef elementor-widget elementor-widget-text-editor\" data-id=\"a3990ef\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span data-contrast=\"auto\">Requesting confirmation when finishing a business process flow in a model-driven app is just one of many examples of validations that can be implemented.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p><p><span data-contrast=\"auto\">Depending on the requirement, data validations and restrictions can\u00a0be achieved through client-side validations using JavaScript or through server-side controls such as Dataverse security roles, business\u00a0units\u00a0or\u00a0business\u00a0rules.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p><p><a href=\"https:\/\/powergi.net\/contact\/\"><span data-contrast=\"none\">Contact us<\/span><\/a><span data-contrast=\"auto\">\u00a0to\u00a0learn how\u00a0our\u202f<\/span><a href=\"https:\/\/powergi.net\/power-apps-consulting-services\/\"><span data-contrast=\"none\">Power Apps<\/span><\/a><span data-contrast=\"auto\">\u202fand\u202f<\/span><a href=\"https:\/\/powergi.net\/microsoft-power-platform-consulting-services\/\"><span data-contrast=\"none\">Power Platform consulting services<\/span><\/a><span data-contrast=\"auto\">\u00a0can help you\u00a0extend standard functionality\u00a0in model-driven apps,\u00a0we\u2019ll\u00a0be more than happy to have a\u00a0conversation.<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Table of Contents In some scenarios, we may need\u00a0to ask users for double confirmation when they click on the \u201cfinish\u201d button of a business process flow (BPF)\u00a0and\u00a0only allow the process to finish after explicit confirmation. This blog will show how to use JavaScript code to customize Model-Driven Apps\u00a0and show users a confirmation dialog before finishing [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":9804,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"glossary_letter":"a","footnotes":""},"categories":[81],"tags":[],"class_list":["post-9784","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-power-apps-cat"],"glossary_letter":"a","rank_math_title":"Add Confirmation Dialog to BPF | Power GI","rank_math_description":"Learn how to add confirmation dialogs to Power Apps Business Process Flows (BPF). Enhance your user experience with this Power GI tutorial.","rank_math_focus_keyword":"confirmation dialog before finishing BPF","_links":{"self":[{"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/posts\/9784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/comments?post=9784"}],"version-history":[{"count":6,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/posts\/9784\/revisions"}],"predecessor-version":[{"id":14947,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/posts\/9784\/revisions\/14947"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/media\/9804"}],"wp:attachment":[{"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/media?parent=9784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/categories?post=9784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/tags?post=9784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}