Microsoft Dynamics CRM 2011 uses URL addressable forms to make it easier for system customizers to pop CRM records from different areas of the application. The URL of each entity form includes information such as the entity type code (or entity type name), the ID of the record, and depending on the current context, the ID of a parent record. In this post, we will take a look at the different URL’s we can use to pop open CRM records.
Let’s take the Account form as an example. Here I have opened up an Account record and pasted the
https://roshan.crm5.dynamics.com/main.aspx?etc=1&extraqs=%3f_gridType%3d1%26etc%3d1%26id%3d%257b6C70AB80-2410-E111-8811-D8D3855B354E%257d%26rskey%3d817502540&pagetype=entityrecord
I have highlighted the most important parts of the URL in bold. First we have the entity type code which is a unique code to identify the entity type. In this case, we can see that the etc has a value of “1” which refers to the Account entity. No two entities in a system will have the same entity type code.
Inside the extraqs parameter, the entity type code is also referenced as well as the globally unique identifier for the record (or GUID).
It is very important to note that the entity type code for a custom entity may differ between organizations. This means that if you had a custom entity called “new_student” with an entity type code of “10102” on a development environment and you deployed the solution to another organization, the entity type code may no longer be “10102”. If you have any JScript with the entity type code hardcoded into the URL, the record will fail to open when the URL is clicked because the entity type code is not correct in the target system. For this reason, we can replace the etc parameter with the etn parameter (or entity type name). Here is what the URL above would look like if we used this parameter.
https://roshan.crm5.dynamics.com/main.aspx?etn=account&extraqs=%3f_gridType%3d1%26etn%3daccount%26id%3d%257b6C70AB80-2410-E111-8811-D8D3855B354E%257d%26rskey%3d817502540&pagetype=entityrecord
Using this URL would achieve the same result and pop the exact same Account record. We can be sure that the entity type name will not change so it is safer to use this method compared to the entity type code.
I recommend using the etn (entity type name) parameter with custom entities as the entity type code varies per organization. In my next post, I will show you how to pass data to forms using the extraqs parameter.