How to delete/modify procinstxml data directly

  • 21 February 2007
  • 4 replies
  • 8 views

Badge +8
K2 does not expect data in the K2 Transaction database to be modified without going through the API so a caching mechanism would not know that it needs to refresh.

Direct Transaction Database interaction is discouraged and unsupported.

Is there a reason that you are not using the API to make these changes?

-Eric

4 replies

Badge
Dear all,

I am trying to delete and modify the XML data directly for one of the process instance.

I have modified the Value field of the particular ProcInstID in the following 2 tables _ProcInstXml and _ProcInstXmlAudit. But when I reload the process, the changes do not seem to take effect.

Just wondering whether there is any cache mechanism in the K2 server?

Thanks a lot in advance.

Regards
Terence.
Badge
One of the our workflow system is in production and we need to do a one off data fix inside a stuck process instance in order to make it flow.

Any help will be appreciated.
Badge
Does anyone have any idea of how to do that?

Thanks in advance.
Badge +13
Get the ProcInstID from the K2 Error Profile then run this with someone who has admin ID. I only tested this against an errored out item and it seems to run fine. After update the data restart the item. Let me know if it works!

Private Sub K2ROM_AdminUpdateProcessInstance(ByVal ProcInstID As Integer)
'Needs Admin rights

Dim oK2Connection As New SourceCode.K2ROM.Connection
Dim oProcInst As SourceCode.K2ROM.ProcessInstance
Dim sFormData As String

oK2Connection.Open("server name here")
oProcInst = oK2Connection.OpenProcessInstance(ProcInstID)

oProcInst.DataFields.Item("Approvals").Value = "My New Value"
sFormData = oProcInst.XmlFields.Item("FormData").Value

sFormData = SourceCode.K2Utilities.XMLFieldMod.SetXMLValue(sFormData, "WorkItemData/Approver", "new value")
oProcInst.XmlFields.Item("FormData").Value = sFormData

oProcInst.Update() 'Requires Process Admin rights

oK2Connection.Close()
End Sub

Reply