United Kingdom - D365-CRM

Expand all | Collapse all

Modal dialogs and the Unified Interface

  • 1.  Modal dialogs and the Unified Interface

    SILVER CONTRIBUTOR
    Posted Jun 19, 2020 05:11 AM
    Scenario -

    A user selects a row (or rows) of a subgrid, and then clicks a ribbon option for that grid.

    The requirement is for the on click action to be user-confirmed - an 'Are you sure?' (Y/N) - prior to proceeding. Additionally, the text presented in confirming needs to be contextual - i.e. 'Are you sure you want to proceed for {<Name of selected row>, <Name of selected row>,...} ?'

    As per my understanding, this requirement - including the passing of context \ selected row(s) into the modal dialog - can be met, in a supported way, through the alert.JS library. Is this correct?

    Either way, are there other approaches to implementing the described requirement - approaches that are better aligned with D365 / not reliant on a 3rd party library?

    Looking forward to some Community insight!

    Sincerely,

    Tamim.

    ------------------------------
    Tamim Sadikali

    D365 Solution Designer
    ------------------------------


  • 2.  RE: Modal dialogs and the Unified Interface

    TOP CONTRIBUTOR
    Posted Jun 22, 2020 03:59 AM

    There's a couple of options:

    Xrm.Navigation.openConfirmDialoghttps://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-navigation/openconfirmdialog
    This will open the standard browser OK / Cancel dialog, and you can build up the text to show in it as part of your script.

    Xrm.Navigation.navigateTohttps://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-navigation/navigateto
    This allows you to open a web resource modally. This involves quite a lot more work, but gives you complete flexibility over how the modal dialog is displayed.

    I'd definitely recommend using the openConfirmDialog method for any simple yes/no confirmation requirement.



    ------------------------------
    Mark Carrington
    Chief Technologist
    Data8
    Chester
    ------------------------------



  • 3.  RE: Modal dialogs and the Unified Interface

    Posted Jun 22, 2020 06:08 AM
    Edited by Ben Thompson Jun 22, 2020 06:48 AM
    My first question would be how important is it to the customer that the contextual information is repeated - the only way to get the information is via an XRM retrieve multiple request with all the work required to write the additional javascript to process the request and create the longer text.

    Apart from that the best approach would be to use the openconfirm dialog box as Mark suggests - navigateTo is too complex for what you need unless you need to ask more questions beyond "Do you want to process the selected records?"

    ------------------------------
    Ben Thompson
    Ben Thompson
    ------------------------------



  • 4.  RE: Modal dialogs and the Unified Interface

    SILVER CONTRIBUTOR
    Posted Jun 29, 2020 11:55 AM
    I have an option set with 2 values [yes|no] and would like to seek confirmation from the user before they toggle the value from Yes to No. I am using Xrm.Navigation.openConfirmDialog with the onChange event but find that the value will be updated on the form regardless of whether confirm has been selected or not. Is there anyway to stop the value being updated until the confirmation (success) has been selected.

    ------------------------------
    Kevin Harrington
    ------------------------------



  • 5.  RE: Modal dialogs and the Unified Interface

    TOP CONTRIBUTOR
    Posted Jun 29, 2020 12:05 PM
    The OnChange event occurs after the change. In your case, when someone selects to cancel it using the confirmation dialog you'll need to change the value back. Thankfully this is quite easy with a boolean field as you can simply invert the new value.

    ------------------------------
    Mark Carrington
    Chief Technologist
    Data8
    Chester
    ------------------------------



  • 6.  RE: Modal dialogs and the Unified Interface

    SILVER CONTRIBUTOR
    Posted Jul 03, 2020 04:28 PM
    Hi Mark,

    Perfect, thanks you for your help!

    ------------------------------
    Kevin Harrington
    ------------------------------