Experience your
30 day trial
now!
GET STARTED
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.
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"/>
</method>
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:http://MyServer/activities/task/edit.aspx?id={D02787BE-6E31-DB11-95BE-0013720EC2DB}
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.
Shashi Ranjan
Great post, I'm trying this out with a custom assembly and I can't get the entity to show up as the second dynamic value in the construct link (just get a blank drop down). It works fine if I use it with a native type (i.e. Task). Any thoughts on how to resolve this?
Hey, it works only for the task because thats the entity name that is provided in the workflow config file registration. You will need to add multiple method section to enable for other entities just replace the entityname in the object id parameter. say for account
<parameter name="objectId" datatype="lookup" entityname="account"/>
I am starting to get my hands on MSCRM 3.0 workflow and these kind of posts are valuable to me. Thank you very much Shashi.
Two remarks/suggestions for improvement before proceeding:
1- IMO, the fact that we have to resort to extensions for such rudimentary tasks is a manifestation of severe limitations of the email templating engine...
2- Although our ConstructLink method is polymorphic, the configuration of the wflow assemblies is really more strongly typed than necessary resulting in redundant entries...
Now, the question: I am trying to insert a hyperlink for the link by formatting the template inside VS2005 and then cut & pasting into the workflow manager without any success. I am not using any email templates since I want to apply this action to a custom entity for which this is not an option.
Any tips?
Dimitris
Did anyone test it? , the workflow service send the email as a plain text, how can you make the url look as a link - (the only choice for the user is to copy the link to the browser and navigate)
change this in your assembly
Return "<a href=" & baseUrl + objectId.ToString("B") & ">" & baseUrl + objectId.ToString("B") & "</a>"
Hi,
I used the above code, but when i run the workflow, i get the error that typename "HelloType" can not be find in assembly Workflowassemblies.dll.
My code is
Imports System
Namespace CRMTest
Public Class HelloType
Public Function ConstructLink(ByVal baseUrl As String, ByVal objectId As Guid) As String
End Function
End Class
End Namespace
What am i doing wrong? Please help.
Thanks,
Ashwani
I created a custom assembly and compiled.
I also registered the custom assembly in the C:\Program Files\Microsoft CRM\Server\bin\assembly\workflow.config file.
I also created a workflow rule to test this but I keep getting this Access Denied message in the workflow monitor.
Fail Error Code = 80070005 Access Denied. You do not have suffieint access rights or permissions to perform this acction.
why do I get this message. Is there something I left out ot forgot.
This code is provided as-is
Network Infrastructure Tecjnologies. Inc.
NIT Connect
http://www.nitconnect.com
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Xml;
// csc /target:library /optimize+ /nologo /out:MyAssembly.dll MyAssembly.cs
namespace NIT.Workflow.Assem
public class MyAssembly
public MyAssembly()
String url = baseUrl + objectId.ToString("B");
String link = "<a href=\"" + url + "\">Link to Case</a>";
return link;
Hi, I followed each single step for this exercise, but the email message is not build correctly.
When I insert the slug subject this shows like this:
<a href=http://london:5555/activities/task/edit.aspx?id={30693c3a-0404-dc11-8aff-0003ff12adb4}>Esta es la liga</a>
Note: after href the URL is include.
BUT, when the same slog is inserted on the body:
<a href=>Esta es la liga</a></pre>
Note: the URL is NOT included.
Can someone help me.
Thanks.
yeah, what if we are working with CRM Online? can't do any of this there right?
yes. Custom workflow activities and plugins are not possible to register on Microsoft CRM online.