Tuesday, November 18, 2014

CRM_URL Manipulation

There is a well known technique for opening an entity form from an SRS report. For example, you can create a hyperlink to the underlying CRM contact record using the following syntax:

=IIF(IsNothing(Parameters!CRM_URL.Value),Nothing,Parameters!CRM_URL.Value & "?ID={"&Fields!contactid.Value.ToString()&"}&LogicalName=contact")

However if you want to create a link to a CRM record without an underlying reference ID to pass then things can become a little more tricky. This is because while you require the server reference provided by the CRM_URL variable (shown in green below), you need to get rid of the "CRMReports/viewer/drillopen.aspx" section as that throws it off (shown in yellow).

This can be achieved by using the following function in the URL action:
=Mid(Parameters!CRM_URL.Value, 1, InStr(Parameters!CRM_URL.Value, "/CRMReports"))

Now you can rebuild the URL anyway you want. For example, you can construct a URL as follows:

And this will open up a new CRM record (with passed defaults etc.).

No comments:

Post a Comment