
After failing duplicating the ParallelApproval Workflow I looked into creating a task by code in the project instead. Didn't find much documentation online so here's my initial Proof of Concept to fill the gap.
This will create a task from the current user and assign it to all users with the WebAdmins role. An e-mail will go out to all users in the role and when one of them change the status an e-mail will go back to the creator.
using EPiServer.Personalization; .. Task currentTask = new Task(); currentTask.Subject = "Test"; currentTask.Description = "Some more text"; currentTask.AssignedTo = "WebAdmins"; currentTask.AssignedIsRole = true; currentTask.DueDate = DateTime.Now.AddDays(1); // Would be better to somehow fetch PlugInID // by it's name "EPiServer.UI.Util.PlugIns.ViewTask" // instead of this: currentTask.PlugInID = 144; currentTask.Save();
Tested using EPiServer CMS 5 R2 SP2.
Categories: EPiServer, Dotnet, Development
Last update Monday 14 December 2009 16:41
RSS for comments to this page Trackback URL
Comment from Author Wednesday 16 December 2009 11:50
Please share if you know the slick way to fetch the PlugInID. Didn't have time to look into it more. I stopped at finding the ID in tblPlugin and hard coded it.
Comment from Mårten Berg Thursday 17 December 2009 10:42
Here is how you get the PlugInID by name:
PlugInDescriptor pid = PlugInDescriptor.Load("EPiServer.UI.Util.PlugIns.ViewTask", "EPiServer.UI");
...
currentTask.PlugInID = pid.ID;
When I did this, I seem to recall that I found out that this way the task plugin is created if it doesn't exist, which it doesn't in a clean EPiServer install, if I remember correctly. It was some time ago I worked with tasks.
Comment from Author Thursday 17 December 2009 12:17
Nice! Thanks.
Another related question is if it's possible to disable the CC mail message going to the creator? The creator get one message CC per user in the assigned role.