Workflow - feedaback while approving the content
In workflow while sending for approval or publishing can approver write some comments or feedback on the content which will be part of notification email. As it is happening while rejecting the content approver can write some comments.
Hello,
There is no functionality to use for sending a comment as part of the approval action like there is a dialog to type a rejection reason when rejecting a publication.
This can be achieved trough creating a custom workflow to handle this case. As an important note here to create custom workflow in sitefinity the site must be running sitefinity profession edition and above because custom workflows are not a feature of sitefinity standard edition.
For creating custom workflow refer to this documentation.
To type a message when approving if the approved content is News item for example, the workflow to be customized will be AnyContentApprovalWorkflow.xamlx, create custom activity for sending emails:
Here is a blog post that provides a sample for creating custom workflow activity that send customized notification email.
The message typed upon approval in a news item can be stored into custom field added to the news item. The custom notification activity to send an email will have to read the input in this textfield (or another field or your choosing) and include the text into the notification email.
To retrieve the custom field inside the workflow activity for sending emails first you have to get the item that is sent for approval and from the item get the value of the custom field having the text for approval reason.
To get the current item passing trough workflow, retrieve the workflow property masterFluent and then use GetValue("FieldName") to retrieve the value in the custom field used for approval reason.
using
Telerik.Sitefinity.Model;
var dataContext = context.DataContext;
//get a property form workflow that carry the item passing trough workflow
var masterFluent = dataContext.GetProperties()[
"masterFluent"
].GetValue(dataContext)
as
AnyDraftFacade;
//get the item custom field value, type the name of the custom field here
var getItemProperties = masterFluent.Get().GetValue(
"CustomFieldName"
);