Microsoft Dynamics CRM is a powerful tool for automating and tracking business processes. It’s built in workflow processes allow you automate processes easily to your business’s own specific requirements. A built-in process that most people have set up are automated emails that are sent out with record-specific information. CRM 2011 makes this easy by allowing you to insert contextual dynamic fields directly in to the body and other fields of the email itself. However, one very useful field is absent–a direct link to the record.

It is only natural to set up a email notification with some summary data and a “Click here for more information” link. But in CRM, there is no obvious way to generate the link that points to the target record. This is a much requested feature by businesses, as it cuts down on record hunting in CRM in these situations.

So, here is a tutorial on how to set up a custom field that can be used to easily and reliably generate direct URL links to records.

Create the Web Resource:

  1. Go to Settings > Customization > Customize the System.
  2. Select Components > Web Resources.
  3. Click the New button and create a new Web Resource.
  4. Fill in the following fields:
    1. Name: direct_url_resource.js
    2. Display Name: direct_url_resource.js
  5. For Type click the Text Editor button.
  6. Paste in the script from [direct_url_resource.js] below.
  7. Save and publish your Web Resource.

Create a Custom Field:

  1. Go to Settings > Customization > Customize the System.
  2. Select Components > Entities > (Target Entity) > Forms.
  3. Edit the main form.
  4. Click the New button to create a new custom field.
  5. Fill in the following fields:
    1. Display Name: Direct URL
    2. Name: new_direct_url
    3. Type: Single Line of Text
    4. Maximum Length: 2000

Customize Your Entity:

  1. Add your new field to the form. Double click it to open Field Properties.
  2. Under Display > Visibility uncheck the “Visible by default” setting and save.
  3. On the main form page, click the Form Properties button.
  4. In Events > Form Libraries click the Add button to add your Web Resource.
  5. In Events > Event Handlers select the Form control and OnLoad event and click the Add button.
  6. Fill in the following fields:
    1. Function: setDirectUrlField
    2. Enabled: Checked
    3. Pass execution context: Unchecked
    4. Parameter list: “new_direct_url” (your custom field name)
  7. Save all your changes, and publish the form.


Like this post? Share it!