c# - Sitecore - Update workflow history -
is possible programmatically set workflow comment? e.g. admin user "reject" item workbox, ask comment. later on, our agent process retrives comment , send email. need custom module same thing (admin reject functionality).
it same code used sitecore set workflow comment guess...
below code executing of workflow commands assuming know id of command item:
public bool execute(item item, id commandid, string comment) { var workflowid = item[fieldids.workflow]; if (string.isnullorempty(workflowid)) { throw new workflowexception("item not in workflow"); } iworkflow workflow = item.database.workflowprovider.getworkflow(workflowid); var workflowresult = workflow.execute(commandid.tostring(), item, comment, false, new object[0]); if (!workflowresult.succeeded) { var message = workflowresult.message; if (string.isnullorempty(message)) { message = "iworkflow.execute() failed unknown reason."; } throw new exception(message); } return true; }
Comments
Post a Comment