Tip #332: Report hyperlinks the logical way

When building hyperlinks to CRM in SSRS reports, there is a right way and a wrong way:

  • Wrong way: hard coding your CRM URL. Do not set your URL to “https://crmserver/….” If you do this use the hyperlink will only work in one environment and will have to be rewritten to work in another environment.
  • Right way: Use the CRM_URL parameter in your report. This makes the report hyperlinks environment agnostic, and your links will work in all environments, even when offline.
  • Wrong way: Using OTC in your hyperlink expression. “=Parameters!CRM_URL.Value & “?OTC=1&ID={“& Fields!accountid.Value.ToString() &”}”” will work, as it calls the Object TypeCode (OTC) of the entity. This never changes for System entities, but custom entity OTC will change when customization is imported into a new environment.
  • Right way: Use the logical entity name in your hyperlink expression instead of OTC. “=Parameters!CRM_URL.Value & “?ID=”& Fields!accountid.Value.ToString & “&LogicalName=account”

5 thoughts on “Tip #332: Report hyperlinks the logical way

  1. Daniel Kasimirowicz says:

    It’s a shame. I built reports wrong in the last 8 years. Thanks for this tip!

  2. RK says:

    This doesn’t work. I get the error below after publishing the report.
    “Error An Error has occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization’s Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.”

    • Joel Lindstrom says:

      That doesn’t mean the tip doesn’t work. If you are on premises, check the event log on the application server. It typically captures error messages for reports. Also, test your report in visual studio. This error is usually caused by an invalid field reference.

  3. Mark says:

    This works perfectly on my SSRS reports that are run manually through CRM 2011 but I can’t get it to work for reports that are scheduled? Any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *