3 Dec’19

D365 General, Dynamics 365, Dynamics CRMOpen HTML in Model pop up in D365 CE

Introduction

When HTML is opened using JavaScript, it can either open in the same window or a different one. This naturally can create ambiguity for the end-user, as the user can either lose focus or reopen the page, which is not a good practice.

 

In this blog, we will look at how we can open the model pop up on the click of a button. 

Implementation

Syntax

Xrm.Navigation.navigateTo(pageInput,navigationOptions).then(successCallback,errorCallback);

Explanation

Xrm.Navigation.navigateTo requires two parameters.

  • pageInput
  • navigationOptions

pageInput: Here you define whether you want to open the HTML Web resource or you want to navigate to the entity list(View).

For HTML Web Resource:

  • pageType: “webresource”, //pass this as it is
  • webresourceName: “cf_TestHTMLCustomizations” // The name of the web resource to load.

For entity list:

  • pageType: ” entitylist”, //pass this as it is
  • entityName: “account” // The logical name of the entity.
  • viewId: “00000000-0000-0000-00AA-000010001002″ // Id of view

navigationOptions: Options for navigating to a page: whether to open inline or in a dialog. If you don’t specify this parameter, page is opened inline by default.

Below shown is the Code:

loadHTML = function() {
     var pageInput = {
     pageType: "webresource",
    webresourceName: "cf_TestHTMLCustomizations"
};
var navigationOptions = {
    target: 2,
    width: 400,
    height: 300,
    position: 1
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
    function success() {
     // Handle dialog closed
           console.log("Inside Success");
    },
    function error() {
          Xrm.Navigation.openAlertDialog({ text: error.message });
    }
);
 }

– Call this function on click of button.

– After doing everything successfully when you will click on button it will open model pop up like below.

 

Refer for more details: https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-navigation/navigateto

Written by

Vaishali Vyas

Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • How to create Dynamics 365 Finance & Operations (formerly Dynamics AX) connection in SSIS

    12 December’ 2019

    Introduction: Creating a Connection is one of the first Steps during the integration of data. While performing Integrati...

    Read more
  • How to create AX (D365 F&0) Connection in SSIS

    12 December’ 2019

    Introduction: Creating a Connection is one of the first Steps during integration of data. While performing Integration w...

    Read more
  • First cut review of new D365 Project Service

    12 December’ 2019

    The new Project Service coming up is a much-advanced version of PSA. Even more, than it will be called as Project Servic...

    Read more
  • Business Central Wave 2 Features – Section 4

    11 December’ 2019

    Introduction: In this blog, I will be attempting to provide information about the new Modern Client features of Business...

    Read more
  • Business Central Wave 2 Features – Section 5

    11 December’ 2019

    Introduction: In this blog, I will be attempting to provide information about the new Modern Client features of Business...

    Read more

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close