Symptoms
Following error is display when we try to display a K2 Form:
Worklist item could not be opened.
Object reference not set to an instance of an object.
at SourceCode.Workflow.Client.DataField.LoadValueFromBytes(Bytee] buf)
at SourceCode.Workflow.Client.DataField.LoadValue()
at SourceCode.Workflow.Client.DataField.get_Value()
at SourceCode.Forms.AppFramework.FormRuntime.ReturnValueFromDataFieldAccordingToType(DataField thisField)
at SourceCode.Forms.AppFramework.FormRuntime.ConstructProcessInformation(XmlDocument viewController, WorklistItem thisWorkListItem, String serialNumber)
at SourceCode.Forms.AppFramework.FormRuntime.LoadProcessInfo(String type, String value, String sharedUser, String managedUser, Boolean offline)
Diagnoses
The origin seems to be link to use of the "process instance migration tool":
This issue should appears if you have in the same time a change on datafield:
- Change of Order.
- AND a change of type from String to another (or revers).
Example:
DataFields ProcessTest Version 1:
IdUser String
StartDate Date
DataFields ProcessTest Version 2:
StartDate Date
IdUser Integer
In this example, the IdUser will be not correctly migrated with the "process instance migration tool" and you can get the error "Object reference not set to an instance of an object."
Here some SQL Queries on K2 Database for help on the analysis:
--List of datafields by version
--Data field
SELECT ProcData.aProcID]
,ProcData.aName]
,ProcData.aHidden]
,ProcData.aAudit]
,ProcData.aOnDemand]
,ProcData.aType]
,ProcData.aValue]
,ProcData.aMetaData]
,ProcData.aCategory],
CASE ProcData.aType]
WHEN 1 THEN 'TypeBoolean'
WHEN 2 THEN 'TypeDate'
WHEN 3 THEN 'TypeDecimal'
WHEN 4 THEN 'TypeDouble'
WHEN 5 THEN 'TypeInteger'
WHEN 6 THEN 'TypeLong'
WHEN 7 THEN 'TypeString'
WHEN 8 THEN 'TypeBinary'
END + ' (' + convert(varchar, ProcData.aType]) + ')' AS Type,
Process.Ver AS ProcessVersion,
Process.ChangeDate AS ProcessDate,
ProcSet.FullName AS "Process Name",
ProcSet.ProcVerId,
CASE ProcSet.ProcVerId
WHEN ProcData.aProcID] THEN 'Default'
END AS 'IsDefault'
FROM MK2].]Server].]ProcData] ProcData
LEFT JOIN NK2].]Server].]Proc] Process ON Process.ID = ProcData.ProcID
LEFT JOIN NK2].]Server].]ProcSet] ProcSet ON ProcSet.ID = Process.ProcSetID
order by 1 desc
--Current data for DataFields:
SELECT TFieldOnDemand].*
FROM MServer].]FieldOnDemand]
--WHERE ProcInstID=4269
ORDER BY 1 DESC
--List of last value (history) of datafields: no impact on the process instance it self.
--This value is the one display by the broker "Workflow report/Process data"
SELECT * FROM MK2].]ServerLog].]ProcInstData]
--WHERE ProcInstID= 4316
ORDER BY 1 DESC
/*
SELECT ProcData.aProcID],
ProcData.aName],
--,ProcData.aHidden]
-- ,ProcData.aAudit]
-- ,ProcData.aOnDemand]
-- ,ProcData.aType]
-- ,ProcData.aValue]
-- ,ProcData.aMetaData]
-- ,ProcData.aCategory],
CASE ProcData.aType]
WHEN 1 THEN 'TypeBoolean'
WHEN 2 THEN 'TypeDate'
WHEN 3 THEN 'TypeDecimal'
WHEN 4 THEN 'TypeDouble'
WHEN 5 THEN 'TypeInteger'
WHEN 6 THEN 'TypeLong'
WHEN 7 THEN 'TypeString'
WHEN 8 THEN 'TypeBinary'
END + ' (' + convert(varchar, ProcData.aType]) + ')' AS Type,
Process.Ver AS ProcessVersion,
--Process.ChangeDate AS ProcessDate,
ProcSet.FullName AS ProcessName
--ProcSet.ProcVerId,
--CASE ProcSet.ProcVerId
-- WHEN ProcData.aProcID] THEN 'Default'
--END AS 'IsDefault'
FROM MK2].]Server].]ProcData] ProcData
LEFT JOIN NK2].]Server].]Proc] Process ON Process.ID = ProcData.ProcID
LEFT JOIN NK2].]Server].]ProcSet] ProcSet ON ProcSet.ID = Process.ProcSetID
order by 1 desc
*/
--SELECT * FROM MK2].]dbo].]_ProcInstData] order by 1 desc
--SELECT * FROM MK2].]ServerLog].]ProcInstData] where procinstId= 4316 order by 1 desc
/*
SELECT ProcData.aProcID],
ProcData.aName],
--,ProcData.aHidden]
-- ,ProcData.aAudit]
-- ,ProcData.aOnDemand]
-- ,ProcData.aType]
-- ,ProcData.aValue]
-- ,ProcData.aMetaData]
-- ,ProcData.aCategory],
CASE ProcData.aType]
WHEN 1 THEN 'TypeBoolean'
WHEN 2 THEN 'TypeDate'
WHEN 3 THEN 'TypeDecimal'
WHEN 4 THEN 'TypeDouble'
WHEN 5 THEN 'TypeInteger'
WHEN 6 THEN 'TypeLong'
WHEN 7 THEN 'TypeString'
WHEN 8 THEN 'TypeBinary'
END + ' (' + convert(varchar, ProcData.aType]) + ')' AS Type,
Process.Ver AS ProcessVersion,
--Process.ChangeDate AS ProcessDate,
ProcSet.FullName AS ProcessName
--ProcSet.ProcVerId,
--CASE ProcSet.ProcVerId
-- WHEN ProcData.aProcID] THEN 'Default'
--END AS 'IsDefault'
FROM MK2].]Server].]ProcData] ProcData
LEFT JOIN NK2].]Server].]Proc] Process ON Process.ID = ProcData.ProcID
LEFT JOIN NK2].]Server].]ProcSet] ProcSet ON ProcSet.ID = Process.ProcSetID
order by 1 desc
*/
Resolution
If you are able to get the previous value, you can try to set these values with the attached tools "DataField Editor".
If it doesn't work, you can either:
- Restart a new instance of the workflow with the same data field values and stop the old instance.
- Or, on the parent process, perform a "go to activity" to re-run the IPC event and thus put again in the error process (stop the old instance also).