Sitecore Workflow – Part 2

This is the quick short second part of the post related to Workflow, that I mentioned I would write at the end of that post.

Initially, we would have set up a workflow with option to send email when an item is submitted for Approval. We would have configured it to be sent to a single pre-defined email id. But in case of a Real Time Situation, with Workflow properly setup, the content management – Approval/Rejection etc would be handled by users with a specified role.

In this case, we have created a role called Content Manager that has necessary permissions for approving/rejecting content item changes. We can create users based on this role and they can approve/reject the content changes.

Creating Roles and assign them member of roles are quite simple and straight forward. You can do that via, Role Manager App under Access Management Section of Sitecore Launchpad.

Access Management 
User Manager 
Access Viewer 
Role Manager 
Security Editor 
Domain 
Manager

Create a role Content Manager with the Privileges.

C 
Delete 
O Not secure I cms.mysitecore.com/sitecore/shell/Applications/Security/RoIe%20Manager.aspx?sc_bw=1 
Member Of 
Add or remove the roles that the selected role must be a member of. 
New 
Role 
o 
Comment 
Role 
Role 
Role 
Role 
Log out 
x 
Search 
I Administrator 
Mem bers 
Member Of 
Doma 
Domain 
sitecore 
sitecore 
sitecore 
sitecore 
Add 
Local name 
sitecoreISitecore Client Maintaining 
sitecore\Sitecore Client Publishing 
sitecore\Sitecore Client Authoring 
Remove 
Search 
Full name 
sitecore\Sitecore Client Maintaining 
sitecore\Sitecore Client Publishing 
sitecore\Sitecore Client Authoring 
sitecore\Author 
sitecore\Analytics Advanced Testing 
sitecoreAnalytics Content Profiling 
sitecoreAnalytics Maintaining 
sitecore\Analytics Management Reporting 
sitecore\Analytics Personalization 
sitecore\Analytics Reporting 
sitecoreAnalytics Testing 
sitecoreAuthor 
sitecore\Content Editor 
sitecoreNContent Manager 
sitecore\Designer 
sitecore\Developer 
sitecore\EXM Advanced Users 
sitpcorp\FXM IJsprs 
Page 1 of (4 items)

For getting info about Sitecore Users and their Roles/Profile Info we can make use of Sitecore.Security.Accounts namespace. RolesInRolesManager.GetUsersInRole return a list of users with the specified role. Based on the User List we get, we can get the email id of individual users. This E-Mail ID can be used for triggering the Email Action mentioned in the earlier part of the post.

public static GetUser5BasedOnRole5(5tring role) 
U?ersList new 
Rol nRoIesManager . Get UsersInRoIe(RoIe . FromName(rol e) , 
User5Li5t — 
return UsersList; 
true) . ToLi5t();
public void SendMaiI(strine From, string TO, string Subject, string mailBody) 
var mail new mailmessage(From, To); 
UserList Helper.GetUsersBasedOnRoIes( Manager"); 
foreach (User user in UserList) 
mail . To.Add(user .pm•file. Email) ; 
mail . Subject • 
Subject; 
= Mai IBody; 
SmtpCIient smtp 587); 
smtp. EnableSsI 
true; 
smtp. useDefaultCredentiaIs • 
— false; 
smtp.Cr•edentiaIs new System . Net . Address", "password"); 
smtp. Send(mail) ;

As we are setting up roles and triggering workflow state changes based on the roles, whenever we add new users to this role, the workflow would still trigger mails to the new users added.

Leave a comment

Design a site like this with WordPress.com
Get started