Sitefinity Workflow: Advanced Notifications for Content Approval

Sitefinity Workflow: Advanced Notifications for Content Approval

Posted on January 15, 2013 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

Sitefinity’s content change notifications are a convenient way to keep designated people informed about  content changes to your website. By applying workflow to selected content items with just one check-box, you can notify authorizers of content pending approval:

Sitefinity Workflow Notify Users Picture

Notification Messages

Notifications are easy to activate and manage in Sitefinity. There is a default setting that delivers a generic change message, but this may not provide the detailed information you need:

Sitefinity Workflow Notify Group Image

The good thing is that the message can be easily changed to accommodate any custom notification scenario, so let’s see how…

Customizing Notification Messages

The possibilities for workflow customizations in Sitefinity are endless, and they offer a convenient way to implement any custom business case. In one of my previous posts, I provided an overview of the different means of workflow customization. For a recap, please click here (link here)

The notification logic is encapsulated in the NotifyGroup activity. It inherits from CodeActivity and provides a few editable properties to allow for customizing the e-mail receivers and the message itself.

Like most Sitefinity components, the NotifyGroup activity is a public class that can be inherited, and its methods can be overridden to achieve complete customization.

The Steps

Since the NotifyGroup activity has already implemented the logic for sending the message to the designated group of users, all you have to do is modify the EmailText property and pass it to the base logic for delivering the messages.

By overriding the Execute void method, we receive instant access to its CodeActivityContext parameter. The latter is part of the System.Activities namespace, which is part of the Windows Workflow Foundation, and as such, carries all relevant information        for the item passing through workflow.

Below is sample logic to demonstrate how you can detect the type of item, and from there, you can access any of its properties such as title, author, date of modification, just name it!

public class NotifyCustom : NotifyGroup
{
    protected override void Execute(System.Activities.CodeActivityContext context)
        {
        //Get the item
                 var dataContext = context.DataContext;
                 var masterFluent = (AnyDraftFacade)dataContext.GetProperties()["masterFluent"].GetValue(dataContext);
                    var item = masterFluent.Get();
         
// Process the EmailText property and modify it with any property you would like include
this.EmailText += “……………………………………..”;
         
                 //This sends the message
                    base.Execute(context);
      }
}

Once you have the "item" object, you can access virtually every single of hist property and compose a message of your choice sending the tile, the summary, just name it.

The final step is to replace the NotifyGroup activity in the workflow with the one create by you. The video from the previous blog post will show you how to accomplish that (link here)

Conclusion

Achieving complete control of your workflow notification is a straight-forward process in Sitefinity. By customizing the notifications, teams can efficiently modify content, while maintaining necessary organizational protections.

progress-logo

The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation