sitecore - Get reviewer from workflow Item for email notification -


upon approve or reject execute custom email notification goes this:

public void process(workflowpipelineargs args)     {                    assert.argumentnotnull(args, "args");         processoritem processoritem = args.processoritem;         if (processoritem != null)         {             //all variables initialized             var site = sitecore.configuration.factory.getsite("website");             string contentpath = args.dataitem.paths.contentpath;                            var contentitem = args.dataitem;             var contentworkflow = contentitem.database.workflowprovider.getworkflow(contentitem);             var contenthistory = contentworkflow.gethistory(contentitem);             var status = "approved";              //get item master database             var workflowitem = sitecore.context.contentdatabase.items[args.dataitem.id];              //get workflow history can email last person in chain.             if (contenthistory.length > 0)             {                 //submitting user (string)                 string lastuser = contenthistory[contenthistory.length - 1].user;                 //sitecore user (so can email address)                 var submittinguser = sitecore.security.accounts.user.fromname(lastuser, false);                 //approve/reject comments                 var comments = args.comments;                  stringbuilder messagebody = new stringbuilder();                  messagebody.appendformat("<div style='font-weight:bold'>domain: {0}</div>", site.hostname);                 messagebody.appendline();                 messagebody.appendformat("<div style='font-weight:bold'>content item: {0}</div>", contentitem.paths.fullpath);                 messagebody.appendline();                 messagebody.appendformat("<div style='font-weight:bold'>status: {0}</div>", status);                 messagebody.appendline();                                    messagebody.appendformat("<div style='font-weight:bold'>approver comments: {0}</div>", comments);                                      mailmessage msg = new mailmessage(fromaddress, submittinguser.profile.email);                 msg.subject = string.format("{0} - content item has been approved", site.hostname);                 msg.body = messagebody.tostring();                 smtpclient smtpclient = new smtpclient(mailserver);                 smtpclient.send(msg);             }         }     } 

problem: can reviewer comments cant figure out how name or email of reviewer.

any ideas?

thanks, c

sitecore.context.user should give access user clicked button, seems you're looking for.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -