1 min read

Adding CRM URLs to E-mail Messages Sent Via Workflow

One of the task that workflow proves very handy is in sending email reminders when tasks are due. To improve the user experience it will be great if we can send the link to the crm entity instance that is due in the email so that users can select the link and go directly to the entity instance and start working on it.

You will have to do the following to enable this functionality.

  • Create a small custom assembly that concatenates a string and GUID.
  • Register the assembly in workflow config file.
  • Create a workflow rule to send email reminders.
  • Activate the workflow rule and you are good to go.

Step 1: Creating the custom assembly.

public string ConstructLink(string baseUrl, Guid objectId)


            return baseUrl + objectId.ToString(“B”);


Compile the funtion to an assembly file. Say workflowtestassembly.dll and let the class name be HelloType.

Step 2: Register the custom assembly in file workflow.config.

<method name=”ConstructLink” assembly=”workflowtestassembly.dll” typename=”HelloType” methodname=”ConstructLink” group=”Link”>

      <parameter name=”baseUrl” datatype=”string”/>

      <parameter name=”objectId” datatype=”lookup” entityname=”task”/>

<result datatype=”string”/>


Step 3: Create a workflow rule.

When Task is created

Wait for 30 min before Task.Due date

ConstructLink: TaskLink

Email To:[owner] Subject: Task is due.

Note: in the custom assembly action Construct link we pass the baseUrl for the task detail page. I.e. http://<servername:portnumber>/activities/task/edit.aspx?id=

For second parameter we pass the object id of the task. This can be done by selecting task in the dynamic value. The object id will be passed to the assembly as GUID.

The return value will look some similar to:

Use the return value of the assembly within the email body via slugs. On the right to the email body on the email form in workflow manager you will see the slug button.

You can write text like.

“ Your task with subject: {!Task.Subject:} is due on {!Task.Due date:} . click the following link to look and update it. Link {!TaskLink:} “

Step 4:  Activate the workflow rule and test it out.