How to load a custom HTML in D365 JavaScript popup

var pageInput = {
    pageType: "webresource",
    webresourceName: "new_sample_webresource.htm"
};
var navigationOptions = {
    target: 2,
    width: 500, // value specified in pixel
    height: 400, // value specified in pixel
    position: 1
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
    function success() {
            // Run code on success
    },
    function error() {
            // Handle errors
    }
);

Options:

  • target: Number. Specify 1 to open the page inline; 2 to open the page in a dialog. Also, rest of the values (width, height, and position) are valid only if you have specified 2 in this value (open page in a dialog).

  • position: (Optional) Number. Specify 1 to open the dialog in center; 2 to open the dialog on the side. Default is 1 (center).

title: (Optional) String. The dialog title on top of the center or side dialog.

Return Value

Returns a promise. The value passed when the promise resolves is dependent on the target:

  • inline: Promise resolves right away, and does not return any value.
  • dialog: Promise resolves when the dialog is closed. An object is passed only if the pageType = entityRecord and you opened the form in create mode. The object has a savedEntityReference array with the following properties to identify the table record created:
  • entityType: The logical name of the table.
  • id: A string representation of a GUID value for the record.
  • name: The primary column value of the record displayed or created.