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.

Added Monday 14 December 2009 16:41 — Tags for this page: Episerver, Development

Comments

  1. Author Comment 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.

  2. 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.

  3. Author Comment 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.

Add Your Comment