Sitecore Workflow is a series of steps/process that shows and explains how the content is been created in Sitecore, and how it’s get reviewed,published or rejected.
Content has to go to different states, before it gets pushed to live site, on the very least we can have following Sitecore workflow states which needs to be reviewed:
We can also add other steps or states in our Sitecore workflow, in case if there is a complex approval process in a specific organization.
In this example, I want to show how we can customize the existing Sitecore workflow email action to include more details to it, we also assume as part of this sample that once the content editor is done with adding/updating the content, they would move it to the next step where content approver will be reviewing the content and provide his/her feedback.
Once content editor assign the content for approval, we would like to send an email to the concerned person, so that they are notified that there is some content which needs to be reviewed, before it goes to live site.
We would like to extend the existing Sitecore workflow email action which is based on “/sitecore/templates/system/workflow/emailaction”
and send more details to reviewer about the content item, which includes:
- Full path of the content item and
- Customized Message text-which includes language and URL, and any other details which are required.
We will then write a custom class which read all our tokens from Message field of email action template, replace it with the content item values and send it over, we need to update the Type field of email action template to include custom class/assembly details.
In the above snippet we are reading the values from email action template, and then calling “GetFieldText()” method which basically replace any tokens which are added to the field(s).
Here, we will be replacing language,version,URL tokens which are added to Message field of email action template.
Once this is done, you should be able to send customized email to reviewer, same customization is possible if you want email alert if the reviewer approves or rejects the content, and you want these details in your email.
I hope this helps somebody.
Happy learning 🙂