0
votes

I would like to be able to include a link in a view on the contact entity of dynamics crm that will pop a custom window that we have built. The custom window needs the contact id and the user id in order to function. Our users have requested that such a link be on the view rather than having to go into the contact record itself. So, is it possible to create a dynamic URL that will be utilized from the view and will be able to determine the contact id and the user id? I would assume I need to do this with a web resource, but I've only ever used a web resource in an iframe.

I have tried to build a web resource and just use the web resource's link to put into a field and display that field on the view, but obviously that didn't work.

Essentially the link would build a url and then pop up a new window with that url. Here's my url structure: https://example.com/mscrm/ticketing/Activity/PhoneCallSave.aspx?cId=00000000-0000-0000-0000-000000000000&id=%7b00000000-0000-0000-0000-000000000000%7d&orgname=00000000-0000-0000-0000-000000000000&userid=%7b00000000-0000-0000-0000-000000000000%7d&type=contact&token=Zf7Hi3PFokqRn3RnTD6hPA

1

1 Answers

0
votes

This is an interesting request that I have not encountered before...

I thought about using a URL-formatted field, and the fact that D365 by default will hyperlink lookup fields. But, with those options you'd have to write data into a field on each Contact or create an entire new record for each Contact, on the fly.

What about creating a separate web resource that contains a table with only one column to hold the dynamically generated URL's? Run the same query as the view to get the Contacts, then generate the URL's and populate them into that "mini-grid". Put the main Contacts view in one section (say two-columns wide), and the mini-grid web resource in a single-column section right next to it, with no border and the same row height.

This way you rely on the main Contact grid for the Contact info, with the mini-grid holding your dynamic URL's (with proper link names of course, rather than raw URL's).

The high-level steps would be:

  1. Get the user's id from the form context.
  2. OnLoad of the sub-grid, get the set of Contact Id's.
  3. Generate the URL for each Contact.
  4. Populate the URL's into the mini-grid in the same order as the Contacts in the sub-grid, so each row in the mini-grid lines up with its Contact row to the left.

Another idea would be to look into the custom icon functionality in V9 to see if there are any hooks in there where you can add a dynamic URL.

You could also write a RetrieveMultiple plugin to dynamically populate a URL-formatted text field. RetrieveMultiple plugins have their caveats. But, how bad is it?

An unsupported option might be to hack the DOM and put your dynamic URL into a blank URL-formatted field in the view.