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”
It’s a shame. I built reports wrong in the last 8 years. Thanks for this tip!
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.”
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.
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?
Check crm_url parameter. If it does not come through, set the appropriate default value for it, pointing it to the server the scheduled reports are for.