web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Navigation.openForm opening Blank Window

(0) ShareShare
ReportReport
Posted on by 1,540

I'm using Dynamics 365 online v9.1. This is in Chrome (I can't test other browsers). Cleared cache/cookies etc.

I have some javascript trying to open an email record from a case onclick of a button in a WebResource.

On some cases it works fine but on others it opens a blank window and I can't see why it's going wrong or what the difference is. If it doesn't work on a certain case, it never works. If it does work then it always works so it's consistent in that regard.

var myactid = $(event.target).attr('data-myactid');
console.log(myactid);
var windowOptions = {
    openInNewWindow: true,
    entityId: myactid,
    entityName: "email"
};
console.log(windowOptions);
window.parent.Xrm.Navigation.openForm(windowOptions);
console.log("window opened");
//var windowOptions = { openInNewWindow: true }; //deprecated method
//parent.Xrm.Utility.openEntityForm("email", myactid, null, windowOptions); //deprecated method


In both a working case and non working case the Guid is being correctly outputted to the console.

The only error I'm getting in the console on the non-working case has the correct Guid but looks like it's not including the base URL:

Not allowed to load local resource: file:///C:/main.aspx?etc=4202&extraqs=%3fetc%3d4202%26id%3d61d7a1a4-6c1a-e911-a979-000d3a388177&histKey=362358727&newWindow=true&pagetype=entityrecord

*This post is locked for comments

I have the same question (0)
  • ChrisJC Profile Picture
    1,540 on at
    RE: Navigation.openForm opening Blank Window

    Hello Goutam,

    It opens in the same window correctly. When I add in

    entityFormOptions["openInNewWindow"] = true;

    it opens a blank window again.

    Here is the response:

    6116.test.JPG

    Thanks,

    Chris

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Navigation.openForm opening Blank Window

    Hi Chris,

    Looks like your code is correct  , still can you please try this once  , removing new window.

    var myactid = $(event.target).attr('data-myactid');
    console.log(myactid);
    var entityFormOptions = {};
    entityFormOptions["entityName"] = "email";
    entityFormOptions["entityId"] = myactid;
    
    // Open the form.
    window.parent.Xrm.Navigation.openForm(entityFormOptions).then(
        function (success) {
            console.log(success);
        },
        function (error) {
            console.log(error);
        });


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans