Wednesday, June 22, 2011

Use workflow to generate hyperlink to CRM records to insert into dialogs and e-mails.

Inserting a static hyperlink into an e-mail or dialog via workflow can be simple since the hyperlink is known at the time you design your workflow (such as http://www.bing.com). However, you might need to insert a hyperlink to other CRM records that are not known at the time you design your workflow (e.g. link to the owner of the primary entity or link to the primary contact of the account).

Quite often I have heard the need to insert dynamic hyperlinks to CRM records via workflow. Typical requirements I have seen include:
  • Workflow should send an email with a link to the primary entity of the workflow.
  • A dialog prompt page should provide a link to a CRM record that is related to the context of the dialog (for example a hyperlink to the primary customer of the account for which the dialog is executing).
I have shared a utility that allows you to easily generate dynamic hyperlinks to CRM records and be able to use them in both dialogs and e-mails.





In order to use the hyperlink utility follow these steps:


1. Download and import the CRM2011 Workflow Utilities CRM solution.


2. When designing your process insert a "Create HyperLink step" for each hyperlink you need to generate.



3. Configure the hyperlink step, you must provide the following configuration parameters:
  • URL of the CRM Organization [Required]. This is usually http://crmserver:port/orgname, but you might have "https" or have no port number.
  • HyperLink to primary entity or related entities [Required]. Select True for primary entity and False for related entities.
  • Attribute name to related entity. If you are creating a hyperlink to a related entity, you must provide the attribute name that relates the two entities. For example, if the primary entity is account and you are creating a hyperlink to the primary contact, specify the "primarycontactid" attribute.
  • HyperLink text. This is the text that the user will click in order to follow the hyperlink. For example, the text in the following hyperlink would be "Bing": Bing. If the hyperlink text is not provded (you leave it empty) then the text used will be the value of the primary field of the entity. For example if you create a hyperlink to an account named "ABC" then the text in the hyperlink will be "ABC". 

    4. Use your hyperlink in a dialog. When designing a prompt/response step for a dialog, you can insert a dynamic expression that uses the "DialogHyperLink" output from the previous step.




    5. Use your hyperlink in an e-mail. When configurin the "Send E-mail" workflow step, you can insert a dynamic expression that uses the "HtmlHyperLink" output from the previous step.




    For more documentation on how to use the CRM 2011 Workflow Utilities visit the CodePlex project here. You can also download the source code if you need to achieve similar functionality but want to build your own solution.

    7 comments:

    1. Hi Gonzalo.Thanks for utilities but how can i access CRM2011WorkflowUtilities.dll source code .Could you share the source code.

      ReplyDelete
    2. Hi Gonzalo.Thanks for utilities but how can i access CRM2011WorkflowUtilities.dll source code .Could you share the source code.

      ReplyDelete
    3. You can download the source code from CodePlex: http://crm2011workflowutils.codeplex.com/SourceControl/list/changesets

      ReplyDelete
    4. Hi Gonzalo,
      does this also works for CRM Online resp. IFD Environment?

      ReplyDelete
    5. It works in IFD, but not in CRM Online "yet". As soon as Microsoft upgrades CRM Online to R8 then you can download the solution marked as "R8" and use it in CRM Online.

      ReplyDelete
    6. Thank you for this excellent instruction - worked perfectly for me!

      ReplyDelete
    7. Hi, Is this working on CRM 2013 Online ?

      ReplyDelete