Try our conversational search powered by Generative AI!

Santosh Achanta
Jan 27, 2013
  4849
(1 votes)

Tailoring workflows for EPiServer 5, 6 and 7

We have enabled out of the box Sequential workflow for one of our customers, the workflow starts when an editor modify or create a page and push 'Ready to Publish' button. Then an approver receives the workflow email and by default the email is from 'task@<hosturl>' if from address is not set up in web.config SMTP settings. So, I have digged into EPiServer.WorkflowFoundation.dll to see why it is happening and found that when a workflow is triggered, it creates a task and use the method SendMail(string fromUser, string toUser, string mailSubject) in EPiServer.Personalization.Task in EPiServer.dll to send email to approvers and by default it look for current user's email id which is not valid in this case as the workflows executes in own threads separate from the thread serving the request and hence the from email address is the fallback one which is 'task@<hosturl>' all the time. Our customer wants the from email address to be the editor’s email address so that the approver knows from the email who actually the editor of the page is.

Solution for this is, get the code for the sequential approval workflow. In there they should locate the activities named “initializeApprovalState” and “InitializeUpdateState”. Inside these there is an activity called “createApprovalTask” and “createOwnerTask” respectively, if these activities are marked and select view properties, a property “NotifyByEmail” can be set to false. Then the builtin email will not be sent.

Then before or after the “createApprovalTask” and “createOwnerTask” activities you can drag in one “SendEmailActivity” in that activity where you can then control how the outgoing email should look like.

See this post for downloading workflow code http://world.episerver.com/Blogs/Johan-Bjornfot/Dates1/2011/8/Source-code-for-the-CMS6R2-built-in-workflows/.

See this post for the steps to get the workflows loaded properly http://geekswithblogs.net/SoftwareDoneRight/archive/2008/01/19/howto-set-up-your-project-for-windows-workflow-c-style.aspx.

This blog post applies for workflows in EPiServer 5, 6 and 7 versions and hopefully workflows in the product will be modified and implement this in mere future.

Let me know if someone is after the same requirement and code for this implementation as I did this already.

Jan 27, 2013

Comments

Please login to comment.
Latest blogs
Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog

The A/A Test: What You Need to Know

Sure, we all know what an A/B test can do. But what is an A/A test? How is it different? With an A/B test, we know that we can take a webpage (our...

Lindsey Rogers | Apr 15, 2024

.Net Core Timezone ID's Windows vs Linux

Hey all, First post here and I would like to talk about Timezone ID's and How Windows and Linux systems use different IDs. We currently run a .NET...

sheider | Apr 15, 2024

What's new in Language Manager 5.3.0

In Language Manager (LM) version 5.2.0, we added an option in appsettings.json called TranslateOrCopyContentAreaChildrenBlockForTypes . It does...

Quoc Anh Nguyen | Apr 15, 2024