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

Announcements

News and Announcements icon
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)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    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);
        });


  • ChrisJC Profile Picture
    1,540 on at

    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

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans