Michael Philip's Blog

Writing about MS Tech with strong focus on Azure & CRM

Configure a Form To Accept Custom Query string Parameters In Microsoft Dynamics CRM

1 Comment

Problem: If you try to open any forms of the CRM with custom  additional query string  parameters you will get an error.

Solution: to add custom query string parameters to any form URL, you must create it first  by the following steps.

Note: we will apply the following steps on the contact entity (it is just an example you can apply it for any entity).

  1. Go to Settings=> Customizations => Customize The System =>Entities=>Contact=>Forms
  2. Open the form on which you like to pass the custom query string parameters
  3. Click on Form Properties
    FormProperties
  4. Click on Parameters
  5. Click add and enter you parameter name and type
    ChooseParameters
  6.   Save & Publish.
    • -VIP !! to pass the parameter in the URL you must add it after the parameter “extraqs”.
    • -Example: “/main.aspx?etn=contact&extraqs=param_1=test&pagetype=entityrecord”
  7. To Access the  query string parameter you can use the following code
    var urlParams = Xrm.Page.context.getQueryStringParameters();
    var ParameterValue= urlParams[‘param_1’];
  8. You can use an out of the box function called “encodeURIComponent” to construct you url in encoded format (for example “=” when encoded is turned into “%3d”)Exmaple: var url =”/main.aspx?etn=contact&extraqs=” + encodeURIComponent(“param_1=test&pagetype=entityrecord”);
  9. If you have any inquiries don’t hesitate to contact me through the blog 🙂
Advertisements

One thought on “Configure a Form To Accept Custom Query string Parameters In Microsoft Dynamics CRM

  1. Thanks for the post. It was really helpful!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s