September 7, 2009

Link to custom entity – use of etn instead of etc argument

If you want to create a direct link to an out-of-a-box entity it is a very simple task: Right-click on one instance (let’s say account) and select “Copy Shortcut”.


Then just just change the GUID in the URL to open desired account. For the Account this URL looks like this: http://SERVER:PORT/OrganizationName/sfa/accts/edit.aspx?id={GUID}

Custom entities

All custom entities have the same URL structure: http://SERVER:PORT/OrganizationName/userdefined/edit.aspx?id={GUID}&etc=EntityTypeCode

Notice the entity type code? This code is created when creating the entity. But for some reason Entity Type Code can be (in most cases) different on every CRM instance. This means that if you are creating a plugin that needs to create a link to the entity, you will have to query metadata to get the code or enter that code in configuration part.

But there is a better way:

Instead of “etc” argument you can use “etn” (Entity Name) in the query string. Then use the logical name of the entity. Logical name is the same on all instances.



1 comment:

Yeray said...

Hi..I have a problem with this... Dont work.I tried a Javascript code as this:


But the iframe doesnt work. The iframe say me that i havent permission od security for get this entity. Any idea?