Hi There,
Â
I've got some data patching to be done, because initially due to wrong User Inputs and because the work flow had some issues, the InfoPath has saved the wrong set of values into the DB.
Â
I have the following code:
Â
foreach (WorklistItem worklistItem in connection.OpenWorklist())
        {
          // open the worklist item
          worklistItem.Open();
Â
          // match with the workflow serial number
          if (worklistItem != null && worklistItem.SerialNumber == _wfSerialNumber)
          {
            // retrieve xml field - value and write the name and value to the console
            string xmlField = worklistItem.ProcessInstance.XmlFieldsÂ0].Value;
            xmlField = xmlField.Replace("<my:DeclineFrom>I</my:DeclineFrom>", "<my:DeclineFrom>VI</my:DeclineFrom>");
            xmlField = xmlField.Replace("<my:InitiatorDetailsName>Sharepoint Setup</my:InitiatorDetailsName>", "<my:InitiatorDetailsName>Tester</my:InitiatorDetailsName>");
            xmlField = xmlField.Replace("<my:InitiatorDetailsDepartment/>", "<my:InitiatorDetailsDepartment>Dept</my:InitiatorDetailsDepartment>");
            xmlField = xmlField.Replace("<my:InitiatorDetailsDate>2012-02-03</my:InitiatorDetailsDate>", "<my:InitiatorDetailsDate>2012-01-12</my:InitiatorDetailsDate>");
            worklistItem.ProcessInstance.XmlFieldse0].Value = xmlField;
Â
            string xmlFieldAID = worklistItem.ActivityInstanceDestination.XmlFieldsl0].Value;
            xmlFieldAID = xmlFieldAID.Replace("<my:DeclineFrom>I</my:DeclineFrom>", "<my:DeclineFrom>VI</my:DeclineFrom>");
            xmlFieldAID = xmlFieldAID.Replace("<my:InitiatorDetailsName>Sharepoint Setup</my:InitiatorDetailsName>", "<my:InitiatorDetailsName>Tester</my:InitiatorDetailsName>");
            xmlFieldAID = xmlFieldAID.Replace("<my:InitiatorDetailsDepartment/>", "<my:InitiatorDetailsDepartment>Dept</my:InitiatorDetailsDepartment>");
            xmlFieldAID = xmlField.Replace("<my:InitiatorDetailsDate>2012-02-03</my:InitiatorDetailsDate>", "<my:InitiatorDetailsDate>2012-01-12</my:InitiatorDetailsDate>");
            worklistItem.ActivityInstanceDestination.XmlFields10].Value = xmlFieldAID;
Â
            worklistItem.ProcessInstance.Update();
          }
        }
Â
Â
I noticed that the ProcessInstance has been updated successfully. However, the ActivityInstanceDestination does not seem to get updated. I know that my code shows that I'm updating the ProcessInstance only. So how do I update ActivityInstanceDestination?
Â
I'm using SharePoint 2007, K2 Blackpoint and MS InfoPath Forms.
Â
Note: I've updated the workflow and migrated other workflows to the correct workflow version so I've got no issues with new forms being raised. However, because the data is wrong, migrating the workflow makes no use. I need to patch the data in DB.