I have some JavaScript registered to the OnLoad event of the Appointment edit page in Dynamics 2011.
I have another page that launches a popup with the following url:
http://dynamicsserver/main.aspx?etn=appointment&extraqs=etc%3d4201&
pagetype=entityrecord#myextraparameter=1
Note the myextraparameter=1 at the end. I need to get that parameter value in my OnLoad JavaScript….but the window.location in my JavaScript returns the following:
http://dynamicsserver/OrgName/userdefined/edit.aspx?etc=4201&pagemode=iframe&sitemappath=Workplace%7cMyWork%7ccnav_dashboards#
instead of the actual URL I need. What’s more interesting is that at the top of the popup window, in the address bar, the URL is reflected correctly as
http://dynamicsserver/main.aspx?etn=appointment&extraqs=etc%3d4201&
pagetype=entityrecord#myextraparameter=1
Xrm.Page.context.getQueryStringParameters() returns the same useless URL’s parameters, not the one I need.
How can I get my parameter?
CRM restricts arbitrary query string parameters from forms.
You can customize a form to accept query string parameters that you can then grab with the Xrm.Page.context.getQueryStringParameters() method you’ve already referenced, the SDK has the details: http://technet.microsoft.com/en-us/library/gg334436.aspx