We are working on introducing some custom code into the workflow on Sitecore 6.2. Currently, our workflow looks something like this:

Our goal is simple: send an e-mail to the applicant whether their version of the content was approved or rejected in the “Pending approval” step, together with the comments made by the reviewer. To do this, we add the action under the “Approve” and “Reject” steps as follows:

We have two big problems trying to write this code.
- There seems to be no easy way to determine which command was selected (a workaround would be to pass the argument in the step of the action, but I would rather find out what was selected)
- ( )
, , :
var contentItem = args.DataItem;
var contentDatabase = contentItem.Database;
var contentWorkflow = contentDatabase.WorkflowProvider.GetWorkflow(contentItem);
var contentHistory = contentWorkflow.GetHistory(contentItem);
if (contentHistory.Length > 0)
{
var status = contentWorkflow.GetState(contentHistory[contentHistory.Length - 1].NewState);
string lastUser = contentHistory[contentHistory.Length - 1].User;
var message = contentHistory[contentHistory.Length - 1].Text;
var submittingUser = sc.Security.Accounts.User.FromName(lastUser, false);
}