Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to redirect to any webresource on button click in MS Dynamics CRM Online?

(0) ShareShare
ReportReport
Posted on by

Hello,

I am facing an problem when I redirect to any HTML webresource 

I have added a HTML page as webresource name "new_My_ProductList" in solution. I have created a button "Go To My Product" in Ribbon and set following function of JS file as command of it. It will open window.

function RedirectToLowStockList() {

          window.open('WebResources/new_My_ProductList', '_blank', 'scrollbars=1,menubar=no,height=500,width=1000,resizable=1,toolbar=no,status=1');
}

Above function is working perfectly whenever URL is like: "https://mydomain.crm.dynamics.com/WebResources/new_My_ProductList"

But sometimes it generate wrong URL and show Error 404

Here is example of wrong URL:

1- https://mydomain.crm.dynamics.com/_root/WebResources/new_My_ProductList

2- https://mydomain.crm.dynamics.com/_form/WebResources/new_My_ProductList 

We can see that there are 2 key word "_root" and "_form" automatically added in URL. 

Can anybody please suggest me solution? If above way not appropriate, can anybody please suggest me appropriate solution?

*This post is locked for comments

  • Verified answer
    RE: How to redirect to any webresource on button click in MS Dynamics CRM Online?

    Hi Nanji,

    Unfortunately there is no supported way of using Xrm.Utility.openWebResource to open windows in a new window, however,

    you could change the users browser settings to "Always open pop-ups in a new window" - (this will affect all pages)

    2) Unsupported approach: butenko.pro/.../dynamics-crm-2013-step-by-step-creating-dialog-windows

    I would obvoiusly advise against the unsupported approach, and have not had to use it myself.

  • RE: How to redirect to any webresource on button click in MS Dynamics CRM Online?

    Hi David,

    This is also look nice and working exact as I wanted but I don't know how to set "_blank" to open webform in new window.

    Xrm.Utility.openWebResource(webResourceName,webResourceData,width, height);

    msdn.microsoft.com/.../jj602956.aspx

    Can you suggest me?

  • RE: How to redirect to any webresource on button click in MS Dynamics CRM Online?

    Hi David,

    It is working most time. But sometime it add "/form/" to URL and show error "HTTP 500". We must find another way which provide 100% surity.

  • Suggested answer
    RE: How to redirect to any webresource on button click in MS Dynamics CRM Online?

    Hi,
    something like:

    var url =  Xrm.Page.context.prependOrgName("WebResources/new_My_ProductList";)  

    window.open( url,'', 'scrollbars=1,menubar=no,height=500,width=1000,resizable=1,toolbar=no,status=1')

    you can find information about the prependOrgName function here:
    https://msdn.microsoft.com/en-us/library/gg334511.aspx#BKMK_prependorgname

    hope this helps,
        David Levins

  • RE: How to redirect to any webresource on button click in MS Dynamics CRM Online?

    Hi David,

    you mean like this:

    var url =  "/" + Xrm.Page.context.getOrgUniqueName() + "WebResources/new_My_ProductList";

    window.open( url,'', 'scrollbars=1,menubar=no,height=500,width=1000,resizable=1,toolbar=no,status=1')

    If I misunderstood, can you please correct me?

  • RE: How to redirect to any webresource on button click in MS Dynamics CRM Online?

    Hi Srikanth,

    Can you suggest me example for above case?

  • Suggested answer
    ansrikanth Profile Picture
    ansrikanth 3,115 on at
    RE: How to redirect to any webresource on button click in MS Dynamics CRM Online?

    a quick work around for you would be using window.location.origin

    window.location.origin


    and prepare the URL on your own before loading.

  • Suggested answer
    RE: How to redirect to any webresource on button click in MS Dynamics CRM Online?

    You can also use prependOrgName which concatenates the slash and org for you i.e. : "/" + ORG_UNIQUE_NAME + path
    e.g:

    var url = prependOrgName('WebResources/new_My_ProductList');
    window.open( url,'', 'scrollbars=1,menubar=no,height=500,width=1000,resizable=1,toolbar=no,status=1')
    

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans