Try our conversational search powered by Generative AI!

Santosh Achanta
Jan 27, 2013
(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

See this post for the steps to get the workflows loaded properly

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


Please login to comment.
Latest blogs
Microsoft announces Natural language to SQL

Finally, Microsoft launches "Natural language to SQL," after it has been available for several months in Optimizely CMS!

Tomas Hensrud Gulla | May 23, 2024 | Syndicated blog

Five easy ways to start personalizing your content right now

If you clicked on this article, you already know that getting the right message to the right person at the right time helps drive conversions and...

Kara Andersen | May 23, 2024

ExtendedCms.TinyMceEnhancements – serwer side webp support

Today I will introduce another small feature of TinyMceEnhancements plugin. The functionality is used to automatically detect whether a browser...

Grzegorz Wiecheć | May 22, 2024 | Syndicated blog

Azure AI Language– Detect Healthcare Content in Optimizely CMS

In this blog post, I showcase how the Azure AI Language service's Text Analytics for health feature can be used to detect healthcare content within...

Anil Patel | May 22, 2024 | Syndicated blog