CRM Online: HTML Web Resource Querystring Broken After Authenticating

Printer-friendly version

When working with HTML web resources, there’s a “data” querystring parameter that allows you to pass extra values along to the page. This can be useful for HTML resources that you would like to present or manipulate data from the current form without needing to use the ID to query for the record, or whenever you have extra parameters that don’t fall into what CRM supports in the querystring:

One quirk that we’ve seen in CRM Online is if the user manages to open the link to the HTML web resource before logging in, the querystring becomes corrupted once the user enters their credentials. There’s a great article that covers this problem over at Dynamics CRM Tip of the Day, which provides the following workaround from Andrii Butenko:

var params = GetGlobalContext()



if (typeof == "undefined") {

    var currentUrl = window.location.href;


    if (currentUrl.indexOf("%3F") != -1) {

        currentUrl = currentUrl.replace("%3F", "?");

        window.location.href = currentUrl;




What that does is check if the code can find the “data” parameter and, if it can’t, replace the “%3F” with the “?” that was originally in the URL. It then uses the fixed URL to reopen the HTML web resource in the same window, so it’ll be important to factor that into your page’s load behavior.

About the Author:

TopLine Strategies delivers the complete integration and development of sales, marketing and customer service technologies that enable corporate clientele to improve revenue streams and strengthen customer interactions. Our project management and consulting is designed to achieve timely delivery, 100 percent user adoption of the technologies we implement and deliver measurable returns on investments for our clients.

Comments (0)

Related Blogs

TheReact Native Open Source roadmap was announced in Q4 2018 after they decided to invest more in the React Native open source community.

October is not just about pumpkins, fall foliage, and cooler temps anymore. October 2018 also means the exciting introduction of Microsoft Dynamics 365 for Customer Engagement.

Back in 2016, Microsoft introduced its intentions to refresh its CRM and ERP strategy with Dynamics 365. At the heart of its services was the Common Data Model (CDM).