Create Custom Modification Form In VS 2012-Part2

1.SPWorkflowModification ContextData is XMLSerialized as String.

2.Get SPWorkflowModification ContextData in modification page

  protected void GetContexData()
        {
            SPWeb currentWeb = SPContext.Current.Web;
            string strWorkflowInstanceId = Convert.ToString(Request["WorkflowInstanceID"]);
            string strModificationId =Convert.ToString(Request["ModificationID"]);
            string strListId = Convert.ToString(Request["List"]);
            SPWorkflow currentWorkflow = new SPWorkflow(currentWeb, new Guid(strWorkflowInstanceId));
            if (currentWorkflow!=null)
            {
                SPWorkflowModification currentModification = currentWorkflow.Modifications[new Guid(strModificationId)];
                txt_context.Text = currentModification.ContextData;
            }
        }

3.Update SPWorkflowModification ContextData in modification page

    SPWeb currentWeb = SPContext.Current.Web;
            string strWorkflowInstanceId = Convert.ToString(Request["WorkflowInstanceID"]);
            string strModificationId = Convert.ToString(Request["ModificationID"]);
            string strListId = Convert.ToString(Request["List"]);
            SPWorkflow currentWorkflow = new SPWorkflow(currentWeb, new Guid(strWorkflowInstanceId));
            if (currentWorkflow != null)
            {
                currentWeb.AllowUnsafeUpdates = true;
                SPWorkflowModification currentModification = currentWorkflow.Modifications[new Guid(strModificationId)];
                currentWeb.Site.WorkflowManager.ModifyWorkflow(currentWorkflow, currentModification, "111;222;333;444;555;666;777;");
                SPUtility.Redirect("WrkStat.aspx", SPRedirectFlags.UseSource, Context);
                currentWeb.AllowUnsafeUpdates = false;
            }
            else
            {
                //SPUtility.Redirect("WrkStat.aspx", SPRedirectFlags.UseSource, Context);
            }

 

4.Get SPWorkflowModification ContextData in Workflow

  workflowProperties.Workflow.Modifications[SPWorkflowModificationId]

相关文章:

  • 2021-06-09
  • 2022-12-23
  • 2022-01-07
  • 2021-11-23
  • 2021-09-11
  • 2021-10-30
  • 2021-12-28
  • 2022-01-27
猜你喜欢
  • 2022-12-23
  • 2021-07-07
  • 2021-11-23
  • 2022-12-23
  • 2021-06-12
  • 2021-10-31
  • 2022-12-23
相关资源
相似解决方案