As Dynamics CRM is a web-based application, we can open various screens by simply providing a URL Link – so we might provide a Salesperson with a quick link to open a new Opportunity Record via the following:
https://mycrm.crmcs.co.uk/main.aspx?etn=opportunity&pagetype=entityrecord
Opening this link will then directly browse into the New Opportunity Form which can be a handy time-saving technique as we could then embed this link into an Intranet or Dashboard to make CRM quicker (and so easier) to use for the end user.

However the real strength of this is the ability to not only open the Opportunity but provide a URL Link which pre-populates certain Fields on the Form.
So we might provide a Link that creates a New Opportunity pre-populated to a particular Customer and/or Opportunity Type.
We can do this adding an additional element to the URL for ‘extraqs’ – so if looked at a basic example of pre-populating the Name of the Opportunity:
This will then prepopulate the ‘name’ field with ‘My Opportunity’.
We can then extend this to include multiple parameters using the same %3D Request String format, alongside separating %26 to separate out the parameters

Obviously the difficult part here is the %3d and %26 ‘tagging’ characters to handle breaks in our Parameters – these are corresponding to the & and = characters within the ‘extraqs’ parameter itself, but make for a difficult URL when it comes to try to human-read what is going on.
This is using HTML Encoding to handle the ‘extraqs’ parameter as a part within the wider Request String. The following link gives more context on this ability to Encode a URL using this % notation as way of handling non-standard characters without confusing the Web Browser:
Obviously this concept of % characters to replace certain characters does not lead itself to typing up human readable URLs, and so to try and make life easier for ourselves, we can look at using a Spreadsheet Excel Formula to build this link for us:

This can then use the SUBSTITUTE Excel Formula to encode our Name/Value Parameters into the right encoding for the URL.
We this freedom, we can look at adding various parameters for our URL and look at how we can add Lookup, Option Set and Custom fields to our URL.
For Option Sets and Custom Fields, this is quite simple as these follow the same format.
For Lookups however, we need to supply the other 2 elements that CRM tracks for each Lookup: the .Name and .Type attributes of the Lookup alongside the code .Id.
So we need to pass our request as lookupid={xxx-xxx-xxx}&lookupidname=RecordName&lookupidtype=RecordType which adds some complexity when working with Lookup fields – however we can work this complexity into our Excel Formula to limit our thinking-time here:

Which then results in passing a more complex set of starting values to our New Opportunity:

Now we have this URL, we can embed this within an Email or Web Page to provide a better User Experience for the End User in potentially giving them a quick link to create a Gap-Fill Opportunity for a particular Customer or with a particular set of starting values.
This is great for a quick static URL, however if we took this principle into a more Web Application point-of-view then we could look at how our Application Code could potentially generate this URL on the fly to give various dynamics URLs at run time for the Entity and Attributes we want – essentially replacing the Spreadsheet here with our own code-behind logic.
The advantage we have here is that we can use a method in the core .NET Framework to handle the URL Encode for us, instead of relying on an Excel Formula.
// build our string of useful parameters
string parameterString = “name=New Business Opportunity&”;
parameterString += “description=Please chase this opportunity and update your notes accordigly&”;
parameterString += “new_businesstype=267040002&”;
parameterString += “customerid={81403A53-6D8C-E511-80BC-00155D05198A}&customeridname=Land and New Homes&customeridtype=account”;
// build the end-url
string urlOpenNewFormInCRM = @”https://mycrm.crmcs.co.uk/main.aspx?etn=opportunity&pagetype=entityrecord&extraqs=” + Server.UrlEncode(parameterString);
// build hyperlink and add into the page
HyperLink linkOpenNewFormInCRM = new HyperLink();
linkOpenNewFormInCRM.NavigateUrl = urlOpenNewFormInCRM;
This gives a more Development-heavy method of achieving the same result as our Formula-based Spreadsheet, which can be handy if developing a custom link to embed in a Webpage, Dashboard or Email.
This ability to provide CRM URL Links that open particular Forms can very useful to tailor the End User Experience and so is embedded throughout CRM – not just for Entity Forms, but also for Advanced Finds, Views and even allowing entirely different Forms to be opened for an Entity Form. (so we could have a link to open Form Type A for a Record, and a separate link to open Form Type B for a record)
The following article from Microsoft’s MSDN expands on this concept and gives the finer detail on how these URL Links work within Dynamics CRM:
Open Forms, Views, Dialogs and Reports with a URL
And we can see this first-hand in CRM, as each Form or Views gives us a button for ‘Email a Link’ which effectively use this functionality to allow Links to certain records to be Emailed through the business using CRM:

The Spreadsheet URL Generator for this article can be downloaded here for future reference: https://support.crmcs.co.uk/downloads/CRMCS_DynamicsCRM_LinkGenerator.xlsx
